diff options
author | tsepez <tsepez@chromium.org> | 2017-01-18 10:24:35 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2017-01-18 10:24:36 -0800 |
commit | e507dc5004184ae3f8fd1cd19b723b4be69a46da (patch) | |
tree | 204cdce265b694625374b11661b485054a20cb8d /fpdfsdk/fpdfdoc_embeddertest.cpp | |
parent | 19c209de418a10f7d5c157cdda38e9308bfa5503 (diff) | |
download | pdfium-e507dc5004184ae3f8fd1cd19b723b4be69a46da.tar.xz |
Bad indexing in CPDF_Document::FindPageIndex when page tree corrupt.
Moving to std::vector from the more forgiving CFX_ArrayTemplate
revealed the dubious page tree traversal, which depends on the
correctness of the /Count entries to properly summarize the total
descendants under a given node.
The only "correct" thing to do is to throw away these counts as parsed,
and re-compute them, perhaps in CountPages(). But I'm not willing to do
that since it may break unknown documents in the wild.
Pass out-params as pointers while we're at it.
BUG=680376
Review-Url: https://codereview.chromium.org/2636403003
Diffstat (limited to 'fpdfsdk/fpdfdoc_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdfdoc_embeddertest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp index 5441bb3ecf..3666687d4d 100644 --- a/fpdfsdk/fpdfdoc_embeddertest.cpp +++ b/fpdfsdk/fpdfdoc_embeddertest.cpp @@ -68,6 +68,16 @@ TEST_F(FPDFDocEmbeddertest, DestGetLocationInPage) { EXPECT_EQ(1, zoom); } +TEST_F(FPDFDocEmbeddertest, BUG_680376) { + EXPECT_TRUE(OpenDocument("bug_680376.pdf")); + + // Page number directly in item from Dests NameTree. + FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First"); + EXPECT_TRUE(dest); + EXPECT_EQ(static_cast<unsigned long>(-1), + FPDFDest_GetPageIndex(document(), dest)); +} + TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) { EXPECT_TRUE(OpenDocument("launch_action.pdf")); |