summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdftext_embeddertest.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-01-27 12:30:19 -0800
committerTom Sepez <tsepez@chromium.org>2015-01-27 12:30:19 -0800
commit506e6dc4649803ab56ef60d73d9a896f1876a7e6 (patch)
tree06a1eb55548cf86cc536608e46523de231835016 /fpdfsdk/src/fpdftext_embeddertest.cpp
parenteef005055d6aafc2cc6066af37ce47d8b15ec7cd (diff)
downloadpdfium-506e6dc4649803ab56ef60d73d9a896f1876a7e6.tar.xz
Add embedder test for stream length beyond end of file.
This was fixed by https://codereview.chromium.org/743263002, but the bug remained open due to confusion. BUG=https://code.google.com/p/pdfium/issues/detail?id=57 R=thestig@chromium.org Review URL: https://codereview.chromium.org/878523003
Diffstat (limited to 'fpdfsdk/src/fpdftext_embeddertest.cpp')
-rw-r--r--fpdfsdk/src/fpdftext_embeddertest.cpp23
1 files changed, 23 insertions, 0 deletions
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);
+}