From c009e8e6bfefa4f77bc02ac0b359b9fe58af384f Mon Sep 17 00:00:00 2001 From: Wei Li Date: Tue, 5 Jan 2016 12:51:32 -0800 Subject: Merge to XFA: Exit infinite loops for cross reference loading When cross reference sections form a loop, our code will enter an infinite loop. Add detection and exit code for v4 cross reference loading. V5 loading was done previously. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1558093002 . (cherry picked from commit aab8f462ea3368ed4825172231131e1a10db978d) Review URL: https://codereview.chromium.org/1556423002 . --- fpdfsdk/src/fpdfview_embeddertest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/fpdfview_embeddertest.cpp b/fpdfsdk/src/fpdfview_embeddertest.cpp index 3be96e7aef..0f4666836f 100644 --- a/fpdfsdk/src/fpdfview_embeddertest.cpp +++ b/fpdfsdk/src/fpdfview_embeddertest.cpp @@ -204,3 +204,11 @@ TEST_F(FPDFViewEmbeddertest, Crasher_454695) { TEST_F(FPDFViewEmbeddertest, Hang_298) { EXPECT_FALSE(OpenDocument("bug_298.pdf")); } + +// Test if the document opens without infinite looping. +// Previously this test will hang in a loop inside LoadAllCrossRefV4. After +// the fix, LoadAllCrossRefV4 will return false after detecting a cross +// reference loop. Cross references will be rebuilt successfully. +TEST_F(FPDFViewEmbeddertest, CrossRefV4Loop) { + EXPECT_TRUE(OpenDocument("bug_xrefv4_loop.pdf")); +} -- cgit v1.2.3