diff options
-rw-r--r-- | BUILD.gn | 1 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 7 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp | 14 | ||||
-rw-r--r-- | pdfium.gyp | 1 | ||||
-rw-r--r-- | testing/resources/bug_459580.in | 47 | ||||
-rw-r--r-- | testing/resources/bug_459580.pdf | 57 |
6 files changed, 123 insertions, 4 deletions
@@ -1573,6 +1573,7 @@ test("pdfium_unittests") { test("pdfium_embeddertests") { sources = [ + "core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp", "fpdfsdk/src/fpdf_dataavail_embeddertest.cpp", "fpdfsdk/src/fpdfdoc_embeddertest.cpp", "fpdfsdk/src/fpdfformfill_embeddertest.cpp", diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index ad8adc1c1c..862852e7b7 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -1577,11 +1577,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"))); +} + diff --git a/pdfium.gyp b/pdfium.gyp index 78b334df90..23bae8d595 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -944,6 +944,7 @@ '<(DEPTH)/v8/include', ], 'sources': [ + 'core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp', 'fpdfsdk/src/fpdf_dataavail_embeddertest.cpp', 'fpdfsdk/src/fpdfdoc_embeddertest.cpp', 'fpdfsdk/src/fpdfformfill_embeddertest.cpp', diff --git a/testing/resources/bug_459580.in b/testing/resources/bug_459580.in new file mode 100644 index 0000000000..f20c141bc9 --- /dev/null +++ b/testing/resources/bug_459580.in @@ -0,0 +1,47 @@ +{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+{{object 2 0}} <<
+ /Type /Pages
+ /MediaBox [ 0 0 600 600 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+
+{{object 6 0}} <<
+>>
+stream
+BT
+/F1 12 Tf
+200 500 Td
+(Hello, world! This is a test pdf for bug 459580.) Tj
+ET
+endstream
+endobj
+{{xref}}
+trailer <<
+ /$$ze 6
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/bug_459580.pdf b/testing/resources/bug_459580.pdf new file mode 100644 index 0000000000..af33efcaec --- /dev/null +++ b/testing/resources/bug_459580.pdf @@ -0,0 +1,57 @@ +%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+2 0 obj <<
+ /Type /Pages
+ /MediaBox [ 0 0 600 600 ]
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <<
+ /F1 4 0 R
+ >>
+ >>
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /Type /Font
+ /Subtype /Type1
+ /BaseFont /Times-Roman
+>>
+endobj
+
+6 0 obj <<
+>>
+stream
+BT
+/F1 12 Tf
+200 500 Td
+(Hello, world! This is a test pdf for bug 459580.) Tj
+ET
+endstream
+endobj
+xref
+0 7
+0000000000 65535 f
+0000000015 00000 n
+0000000061 00000 n
+0000000154 00000 n
+0000000374 00000 n
+0000000000 65535 f
+0000000450 00000 n
+trailer <<
+ /$$ze 6
+ /Root 1 0 R
+>>
+startxref
+963
+%%EOF
|