Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: core/fpdfapi/parser/fpdf_parser_utility.cpp

Issue 2430743003: in the attempt to fix 627393, changed IFX_FileRead's readBlock to return the length it reads
Patch Set: delete the include folder Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/fpdfapi/parser/fpdf_parser_utility.cpp
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 630754a23b4ce3607486d5998fffba0a002f05b1..d7f62b1096991801662ac0d2e4586cb9d0d5d730 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -72,7 +72,7 @@ int32_t GetHeaderOffset(IFX_SeekableReadStream* pFile) {
const size_t kBufSize = 4;
uint8_t buf[kBufSize];
for (int32_t offset = 0; offset <= 1024; ++offset) {
- if (!pFile->ReadBlock(buf, offset, kBufSize))
+ if (pFile->ReadBlock(buf, offset, kBufSize) != kBufSize && !pFile->IsEOF())
return -1;
if (memcmp(buf, "%PDF", 4) == 0)
Tom Sepez 2016/11/14 20:27:40 might not have read 4 bytes if EOF.

Powered by Google App Engine
This is Rietveld 408576698