summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfdoc_embeddertest.cpp
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-03-03 11:28:06 -0800
committerWei Li <weili@chromium.org>2016-03-03 11:28:06 -0800
commit0e2e5d7554af277cfb312294378c2cd862a349d5 (patch)
tree34cf0f04ef734f7bd08cdd91204e8dd249ffeb63 /fpdfsdk/src/fpdfdoc_embeddertest.cpp
parentd8741afa1c3f31723ec62131d1bb8a78081cd1e4 (diff)
downloadpdfium-0e2e5d7554af277cfb312294378c2cd862a349d5.tar.xz
Fix infinite loop for bookmark search
BUG=pdfium:420 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1757373002 .
Diffstat (limited to 'fpdfsdk/src/fpdfdoc_embeddertest.cpp')
-rw-r--r--fpdfsdk/src/fpdfdoc_embeddertest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/fpdfsdk/src/fpdfdoc_embeddertest.cpp b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
index a789dade36..0ca6a48ca7 100644
--- a/fpdfsdk/src/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
@@ -125,3 +125,14 @@ TEST_F(FPDFDocEmbeddertest, FindBookmarks) {
GetFPDFWideString(L"A BAD Beginning");
EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), bad_title.get()));
}
+
+// Check circular bookmarks will not cause infinite loop.
+TEST_F(FPDFDocEmbeddertest, FindBookmarks_bug420) {
+ // Open a file with circular bookmarks.
+ EXPECT_TRUE(OpenDocument("bookmarks_circular.pdf"));
+
+ // Try to find a title.
+ std::unique_ptr<unsigned short, pdfium::FreeDeleter> title =
+ GetFPDFWideString(L"anything");
+ EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), title.get()));
+}