Add CF test case for bug 981288.
The test passes on ToT, but fails on 73bd37c8.
Bug: chromium:981288
Change-Id: I48b5970fe1813d7b01e57f860ac863d3761992f4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/57352
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 91a2ccb..1e1c9ca 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -303,6 +303,7 @@
]
deps = [
"core/fpdfapi/edit:embeddertests",
+ "core/fpdfapi/page:embeddertests",
"core/fpdfapi/parser:embeddertests",
"core/fpdfapi/render:embeddertests",
"core/fxcodec:embeddertests",
diff --git a/core/fpdfapi/page/BUILD.gn b/core/fpdfapi/page/BUILD.gn
index 6244b8d..0420a29 100644
--- a/core/fpdfapi/page/BUILD.gn
+++ b/core/fpdfapi/page/BUILD.gn
@@ -126,3 +126,13 @@
]
pdfium_root_dir = "../../../"
}
+
+pdfium_embeddertest_source_set("embeddertests") {
+ sources = [
+ "cpdf_colorspace_embeddertest.cpp",
+ ]
+ deps = [
+ ":page",
+ ]
+ pdfium_root_dir = "../../../"
+}
diff --git a/core/fpdfapi/page/cpdf_colorspace_embeddertest.cpp b/core/fpdfapi/page/cpdf_colorspace_embeddertest.cpp
new file mode 100644
index 0000000..ea1d83a
--- /dev/null
+++ b/core/fpdfapi/page/cpdf_colorspace_embeddertest.cpp
@@ -0,0 +1,16 @@
+// Copyright 2019 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_ColorspaceEmbedderTest : public EmbedderTest {};
+
+// Test passes if it does not crash.
+TEST_F(CPDF_ColorspaceEmbedderTest, Bug_981288) {
+ ASSERT_TRUE(OpenDocument("bug_981288.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_TRUE(page);
+ UnloadPage(page);
+}
diff --git a/testing/resources/bug_981288.in b/testing/resources/bug_981288.in
new file mode 100644
index 0000000..749e745
--- /dev/null
+++ b/testing/resources/bug_981288.in
@@ -0,0 +1,67 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /Kids [3 0 R]
+ /Count 1
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /MediaBox [0 0 595 842]
+ /Resources 4 0 R
+ /Contents 6 0 R
+>>
+endobj
+{{object 4 0}} <<
+ /ExtGState <<
+ /GSa 5 0 R
+ >>
+ /ColorSpace <<
+ /PCSp [/Pattern /DeviceRGB]
+ >>
+ /Pattern <<
+ /Pat9 7 0 R
+ >>
+>>
+endobj
+{{object 5 0}} <<
+ /Type /ExtGState
+ /ca 1.0
+ /SA true
+ /CA 1.0
+ /AIS false
+ /SMask /None
+ /SM 0.02
+>>
+endobj
+{{object 6 0}} <<
+ {{streamlen}}
+>>
+stream
+/PCSp cs
+/Pat9 scn
+/GSa gs
+q
+Q
+endstream
+endobj
+{{object 7 0}} <<
+ /Type /Pattern
+ /PatternType 1
+ /TilingType 1
+ /PaintType 1
+ {{streamlen}}
+>>
+stream
+endstream
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/bug_981288.pdf b/testing/resources/bug_981288.pdf
new file mode 100644
index 0000000..17a8ad2
--- /dev/null
+++ b/testing/resources/bug_981288.pdf
@@ -0,0 +1,81 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+endobj
+2 0 obj <<
+ /Type /Pages
+ /Kids [3 0 R]
+ /Count 1
+>>
+endobj
+3 0 obj <<
+ /Type /Page
+ /Parent 2 0 R
+ /MediaBox [0 0 595 842]
+ /Resources 4 0 R
+ /Contents 6 0 R
+>>
+endobj
+4 0 obj <<
+ /ExtGState <<
+ /GSa 5 0 R
+ >>
+ /ColorSpace <<
+ /PCSp [/Pattern /DeviceRGB]
+ >>
+ /Pattern <<
+ /Pat9 7 0 R
+ >>
+>>
+endobj
+5 0 obj <<
+ /Type /ExtGState
+ /ca 1.0
+ /SA true
+ /CA 1.0
+ /AIS false
+ /SMask /None
+ /SM 0.02
+>>
+endobj
+6 0 obj <<
+ /Length 31
+>>
+stream
+/PCSp cs
+/Pat9 scn
+/GSa gs
+q
+Q
+endstream
+endobj
+7 0 obj <<
+ /Type /Pattern
+ /PatternType 1
+ /TilingType 1
+ /PaintType 1
+ /Length 0
+>>
+stream
+endstream
+endobj
+xref
+0 8
+0000000000 65535 f
+0000000015 00000 n
+0000000068 00000 n
+0000000131 00000 n
+0000000245 00000 n
+0000000392 00000 n
+0000000502 00000 n
+0000000584 00000 n
+trailer <<
+ /Root 1 0 R
+ /Size 8
+>>
+startxref
+699
+%%EOF