summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser/cpdf_parser_embeddertest.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-04-29 10:24:02 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-29 10:24:02 -0700
commitcd1e9ff4f432cbc29ed279e6891fb7ddc2ea3734 (patch)
treee041c06e74618aba9768cacf1245fd0168e8ba56 /core/fpdfapi/fpdf_parser/cpdf_parser_embeddertest.cpp
parentd15ba4e29607665db35bc6fb610cc566981b324a (diff)
downloadpdfium-cd1e9ff4f432cbc29ed279e6891fb7ddc2ea3734.tar.xz
Relax a couple checks to allow certain non-standard PDF files.
Some non-standard PDF files misuse the size of cross reference table, and reuse some object number which the old one is still in use. PDFium can relax the reusing of xref objects only since it is not referred in the pdf document. When the size of cross reference table is larger than defined, PDFium will try to continue other than abort. BUG=chromium:596947 Review-Url: https://codereview.chromium.org/1926823002
Diffstat (limited to 'core/fpdfapi/fpdf_parser/cpdf_parser_embeddertest.cpp')
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_parser_embeddertest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser_embeddertest.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser_embeddertest.cpp
index 042b221554..d070bd6a4c 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_parser_embeddertest.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_parser_embeddertest.cpp
@@ -54,3 +54,19 @@ TEST_F(CPDFParserEmbeddertest, Bug_602650) {
FPDFText_ClosePage(text_page);
UnloadPage(page);
}
+
+TEST_F(CPDFParserEmbeddertest, Bug_596947) {
+ // Test the case that the size of cross reference entries doesn't match with
+ // what is defined, and a certain case of reuse object number for cross
+ // reference object.
+ EXPECT_TRUE(OpenDocument("bug_596947.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ EXPECT_NE(nullptr, page);
+ FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page);
+ EXPECT_NE(nullptr, text_page);
+ // The page should not be blank.
+ EXPECT_LT(0, FPDFText_CountChars(text_page));
+
+ FPDFText_ClosePage(text_page);
+ UnloadPage(page);
+}