diff options
author | Wei Li <weili@chromium.org> | 2015-12-06 20:24:25 -0800 |
---|---|---|
committer | Wei Li <weili@chromium.org> | 2015-12-06 20:24:25 -0800 |
commit | 63da7474adf5b585d5fd10729a99a2c50c20a626 (patch) | |
tree | 4f67595de1b66c52d8c8081084b48e15d6959397 /core/src/fpdfapi | |
parent | c73a1442aeea509847e3232f3a38baa823692542 (diff) | |
download | pdfium-63da7474adf5b585d5fd10729a99a2c50c20a626.tar.xz |
Merge to XFA: fix for stream object reading
Loosen a check for earlier version of PDF files. When the bytes with
specified length are followed by 'endstream' keyword, even if there is
no EOL marker before the keyword, it signals the end of stream.
BUG=551258
TBR=jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/1499433002 .
(cherry picked from commit 0ff66089c87ab6e3adaaff0ec69728ce7a8d8299)
Review URL: https://codereview.chromium.org/1504723002 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index b28bbf169b..04aca91082 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -2352,11 +2352,11 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, m_Pos += ReadEOLMarkers(m_Pos); FXSYS_memset(m_WordBuffer, 0, ENDSTREAM_LEN + 1); GetNextWord(); - if (FXSYS_memcmp(m_WordBuffer, "endstream", ENDSTREAM_LEN) == 0 && - IsWholeWord(m_Pos - ENDSTREAM_LEN, m_FileLen, - FX_BSTRC("endstream").GetPtr(), ENDSTREAM_LEN, TRUE)) { + // Earlier version of PDF specification doesn't require EOL marker before + // 'endstream' keyword. If keyword 'endstream' follows the bytes in + // specified length, it signals the end of stream. + if (FXSYS_memcmp(m_WordBuffer, "endstream", ENDSTREAM_LEN) == 0) bSearchForKeyword = FALSE; - } } if (bSearchForKeyword) { // If len is not available, len needs to be calculated |