summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-04-06 15:58:30 -0700
committerLei Zhang <thestig@chromium.org>2015-04-06 15:58:30 -0700
commit072a24fbc055e84198ce95b7b7b264933a43e8db (patch)
tree2c3f27a867942a3db44f2d1b8797770f81a1cb72 /core
parente3dd159edee8cf2eec3f30f77ef6830597c1bc2f (diff)
downloadpdfium-072a24fbc055e84198ce95b7b7b264933a43e8db.tar.xz
Add embedder test comparing with the last patch.
When there is a wrong keyword like '??ze' in the dictionary of the trailer, PDFium can't recognize it and aborts further parsing. After this change, PDFium continues even it can't get the right size at this moment. It will rebuild the cross reference table later since the size of the table is missing. BUG=459580 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1055323003 (cherry picked from commit e26ddf5eb0400c85680a865b6d4ddff293167169) Review URL: https://codereview.chromium.org/1061033004
Diffstat (limited to 'core')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp7
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp14
2 files changed, 17 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 4ed4c70e27..592f24f40b 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -1573,11 +1573,10 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse
return FALSE;
}
FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
- if (xrefsize == 0) {
- return FALSE;
+ if (xrefsize > 0) {
+ m_CrossRef.SetSize(xrefsize);
+ m_V5Type.SetSize(xrefsize);
}
- m_CrossRef.SetSize(xrefsize);
- m_V5Type.SetSize(xrefsize);
}
FX_DWORD dwRet = SetEncryptHandler();
if (dwRet != PDFPARSE_ERROR_SUCCESS) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp
new file mode 100644
index 0000000000..473c6eac10
--- /dev/null
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp
@@ -0,0 +1,14 @@
+// Copyright 2015 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+class FPDFParserEmbeddertest : public EmbedderTest {
+};
+
+Test_F(FPDFParserEmbeddertest, LoadError_454695) {
+ EXPECT_TRUE(OpenDocument("testing/resources/bug_454695.pdf")));
+}
+