summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfdoc_embeddertest.cpp
diff options
context:
space:
mode:
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()));
+}