From 26b8a5b56c255618097cb3a26f640ce6cafce56f Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 27 Jan 2015 12:42:36 -0800 Subject: Merge to XFA: Add embedder test for stream length beyond end of file. Original Review URL: https://codereview.chromium.org/878523003 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/876393003 --- fpdfsdk/src/fpdftext_embeddertest.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 fpdfsdk/src/fpdftext_embeddertest.cpp (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/fpdftext_embeddertest.cpp b/fpdfsdk/src/fpdftext_embeddertest.cpp new file mode 100644 index 0000000000..3198fe0f86 --- /dev/null +++ b/fpdfsdk/src/fpdftext_embeddertest.cpp @@ -0,0 +1,23 @@ +// Copyright 2015 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "../../testing/embedder_test.h" +#include "../../fpdfsdk/include/fpdfview.h" +#include "../../fpdfsdk/include/fpdftext.h" +#include "testing/gtest/include/gtest/gtest.h" + +class FPDFTextEmbeddertest : public EmbedderTest { +}; + +// Test that the page has characters despite a bad stream length. +TEST_F(FPDFTextEmbeddertest, StreamLengthPastEndOfFile) { + EXPECT_TRUE(OpenDocument("testing/resources/bug_57.pdf")); + FPDF_FORMHANDLE form_handle = SetFormFillEnvironment(); + FPDF_PAGE page = LoadPage(0, form_handle); + EXPECT_NE(nullptr, page); + FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page); + EXPECT_NE(nullptr, textpage); + EXPECT_EQ(13, FPDFText_CountChars(textpage)); + ClearFormFillEnvironment(form_handle); +} -- cgit v1.2.3