summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-04-13 20:04:27 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-13 20:04:27 +0000
commit97b47dc407e772a82782d5d64de5560992df2bf9 (patch)
tree7c2c450355d4fde80381d14f61f3a94ae9242aa1
parentecc0123613fa6f455a5a0b498695fb2ea54eed64 (diff)
downloadpdfium-97b47dc407e772a82782d5d64de5560992df2bf9.tar.xz
Add test for circular CPDF_Function::Load().
Bug: chromium:830221 Change-Id: Ia96086a1b930600a4fb9054123c867d1c8b301eb Reviewed-on: https://pdfium-review.googlesource.com/30671 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r--BUILD.gn1
-rw-r--r--core/fpdfapi/page/cpdf_function_embeddertest.cpp16
-rw-r--r--testing/resources/bug_830221.pdf21
3 files changed, 38 insertions, 0 deletions
diff --git a/BUILD.gn b/BUILD.gn
index ff9bb08465..45857e552d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -2965,6 +2965,7 @@ test("pdfium_embeddertests") {
sources = [
"core/fpdfapi/edit/cpdf_creator_embeddertest.cpp",
"core/fpdfapi/page/cpdf_docpagedata_embeddertest.cpp",
+ "core/fpdfapi/page/cpdf_function_embeddertest.cpp",
"core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp",
"core/fpdfapi/parser/cpdf_parser_embeddertest.cpp",
"core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp",
diff --git a/core/fpdfapi/page/cpdf_function_embeddertest.cpp b/core/fpdfapi/page/cpdf_function_embeddertest.cpp
new file mode 100644
index 0000000000..521cc0f814
--- /dev/null
+++ b/core/fpdfapi/page/cpdf_function_embeddertest.cpp
@@ -0,0 +1,16 @@
+// Copyright 2018 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 "testing/gtest/include/gtest/gtest.h"
+
+class CPDF_FunctionEmbeddertest : public EmbedderTest {};
+
+TEST_F(CPDF_FunctionEmbeddertest, Crasher_830221) {
+ EXPECT_TRUE(OpenDocument("bug_830221.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_TRUE(page);
+ RenderLoadedPage(page);
+ UnloadPage(page);
+}
diff --git a/testing/resources/bug_830221.pdf b/testing/resources/bug_830221.pdf
new file mode 100644
index 0000000000..317a5266ef
--- /dev/null
+++ b/testing/resources/bug_830221.pdf
@@ -0,0 +1,21 @@
+%PDF
+1 0 obj
+<</Contents 1 0 R/Resources 4 0 R/K
+j
+6 0 obj
+<</Functions[7 0 R]
+/Domain [0 1]
+/FunctionType 3/>>stream
+/1 CS]2 0 obj<< /Kids[1 0 R]/ ou
+3 0 obj
+<< /Pages 2 0 R>
+endobj
+4 0 obj
+<< /ColorSpace<</1 9 0 R>endobj
+7 0 obj
+<</Functions[6 0 R]/Domain[0 1]
+/FunctionType 3
+/n
+f
+9 0 obj[/Sepa/1 /DeviceRGB 7 0 R]trailer
+<</Root 3 0 R>> \ No newline at end of file