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

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

Issue 2430743003: in the attempt to fix 627393, changed IFX_FileRead's readBlock to return the length it reads
Patch Set: fix an undefined variable 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/cpdf_syntax_parser.cpp
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 842ef2b22201143cbda709303041412adf3c8a30..e874d87e7f6c9d38b3135183c4e6140144e01c21 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -64,7 +64,8 @@ bool CPDF_SyntaxParser::ReadChar(FX_FILESIZE read_pos, uint32_t read_size) {
read_pos = m_FileLen - read_size;
}
}
- if (!m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size))
+ if (m_pFileAccess->ReadBlock(m_pFileBuf, read_pos, read_size) != read_size &&
+ !m_pFileAccess->IsEOF())
return false;
m_BufOffset = read_pos;
@@ -108,9 +109,11 @@ bool CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
}
bool CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, uint32_t size) {
- if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size))
+ uint32_t readSize =
+ m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size);
+ if (readSize != size && !m_pFileAccess->IsEOF())
return false;
- m_Pos += size;
+ m_Pos += readSize;
return true;
}

Powered by Google App Engine
This is Rietveld 408576698