From cf68f216d9783041c8f33f5f2ede93ce16517e66 Mon Sep 17 00:00:00 2001 From: Chris Davis Date: Thu, 15 Jun 2017 23:41:10 -0700 Subject: [PATCH] Fix infinite loop in image parser with zero sized files --- PIFShellExtensionsLib/PIFParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PIFShellExtensionsLib/PIFParser.cpp b/PIFShellExtensionsLib/PIFParser.cpp index 9e3c392..81dbcb3 100644 --- a/PIFShellExtensionsLib/PIFParser.cpp +++ b/PIFShellExtensionsLib/PIFParser.cpp @@ -356,7 +356,7 @@ HRESULT CBaseImageParser::ReadLineFromStream( while (SUCCEEDED(hr) && IsWhitespace(chCurrent)) { hr = IStream_Read(pStream, (void*)&chCurrent, sizeof(char)); - if (IsWhitespace(chCurrent)) + if (SUCCEEDED(hr) && IsWhitespace(chCurrent)) { // If we found leading white space chars we need to update // our origin.