summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-01-05 12:51:32 -0800
committerWei Li <weili@chromium.org>2016-01-05 12:51:32 -0800
commitc009e8e6bfefa4f77bc02ac0b359b9fe58af384f (patch)
tree304f44f6e2c950301579cec9faa692d624f0b8c9 /fpdfsdk/src
parent8ab45eafebfd510554920e09e5ee85e94701dea9 (diff)
downloadpdfium-c009e8e6bfefa4f77bc02ac0b359b9fe58af384f.tar.xz
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 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdfview_embeddertest.cpp8
1 files changed, 8 insertions, 0 deletions
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"));
+}