From f2b300af96e05bb372664752a64f6ab506820a12 Mon Sep 17 00:00:00 2001 From: Wei Li Date: Mon, 11 Jan 2016 14:16:10 -0800 Subject: Merge to XFA: Fix an infinite loop parsing in CPDF_SyntaxParser::GetObject() CPDF_SyntaxParser::GetObject() may enter into an infinite loop when a signature dictionary doesn't have 'Contents' field. Add a check to avoid that. BUG=pdfium:344 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1575833004 . (cherry picked from commit d3ab0f383f6736657480a8bb418c5e715a1aed3b) Review URL: https://codereview.chromium.org/1571333004 . --- fpdfsdk/src/fpdfview_embeddertest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'fpdfsdk') diff --git a/fpdfsdk/src/fpdfview_embeddertest.cpp b/fpdfsdk/src/fpdfview_embeddertest.cpp index 6a6d076983..3147c01660 100644 --- a/fpdfsdk/src/fpdfview_embeddertest.cpp +++ b/fpdfsdk/src/fpdfview_embeddertest.cpp @@ -221,4 +221,10 @@ TEST_F(FPDFViewEmbeddertest, CrossRefV4Loop) { // cause infinite loop. TEST_F(FPDFViewEmbeddertest, Hang_343) { EXPECT_FALSE(OpenDocument("bug_343.pdf")); +} + +// The test should pass when the absence of 'Contents' field in a signature +// dictionary will not cause an infinite loop in CPDF_SyntaxParser::GetObject(). +TEST_F(FPDFViewEmbeddertest, Hang_344) { + EXPECT_FALSE(OpenDocument("bug_344.pdf")); } \ No newline at end of file -- cgit v1.2.3