summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_parser.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-09-28 17:58:18 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-09-28 15:10:48 +0000
commit0ec10f94ae0ec1927c4a33cd69eac0a5fbdcbd52 (patch)
tree57463da5d9d6fcf2aa310e0e9153078123edd977 /core/fpdfapi/parser/cpdf_parser.cpp
parent6e376202fca5c4f77645ba0eeee56ef3c44615a3 (diff)
downloadpdfium-0ec10f94ae0ec1927c4a33cd69eac0a5fbdcbd52.tar.xz
Fix infinite loop on form availability check.
The problem was, that the CPDF_SyntaxParser read last block not from requested position. In this case It move down requested position to fill whole buffer. As result this additional data was not requested by DownloadHints. To fix this allow resize data buffer in CPDF_SyntaxParser, to store more small block, and always read from requsted position. Also add reading check into CPDF_Parser::LoadLinearizedMainXRefTable to prevent infinite loops. Change-Id: I14d3f4457393025dca390aa3ceaa940716463534 Reviewed-on: https://pdfium-review.googlesource.com/11891 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 6fb0d5fa1d..6643cf5123 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -1459,7 +1459,8 @@ CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() {
(FX_FILESIZE)(m_pSyntax->GetPos() + m_pSyntax->m_HeaderOffset)) {
break;
}
- m_pSyntax->GetNextChar(ch);
+ if (!m_pSyntax->GetNextChar(ch))
+ return HANDLER_ERROR;
}
m_LastXRefOffset += dwCount;
m_ObjectStreamMap.clear();