Add regression test for a crash in CPDF_TextState::GetFont().
Also fix a small error and some nits in bug_1286.in.
BUG=pdfium:1294
Change-Id: Ic4307f972410a814fa63cc95f1eb151d8daabd78
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/54330
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/resources/pixel/bug_1286.in b/testing/resources/pixel/bug_1286.in
index e3d0133..0a11df7 100644
--- a/testing/resources/pixel/bug_1286.in
+++ b/testing/resources/pixel/bug_1286.in
@@ -1,7 +1,7 @@
{{header}}
{{object 1 0}} <<
- /Type /Catalog
- /Pages 2 0 R
+ /Type /Catalog
+ /Pages 2 0 R
>>
endobj
{{object 2 0}} <<
@@ -14,7 +14,7 @@
/Type /Page
/Contents 5 0 R
/MediaBox [0 0 600 850]
- /Parent 3 0 R
+ /Parent 2 0 R
/Resources <<
/ColorSpace << /CS0 [/Pattern] >>
/ExtGState << /GS0 6 0 R /GS1 7 0 R >>
@@ -47,7 +47,6 @@
50 700 100 100 re
B
Q
-
q
/GS1 gs /Pattern cs /P0 scn
50 580 100 100 re
diff --git a/testing/resources/pixel/bug_1294.in b/testing/resources/pixel/bug_1294.in
new file mode 100644
index 0000000..3b35bb1
--- /dev/null
+++ b/testing/resources/pixel/bug_1294.in
@@ -0,0 +1,45 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /Count 1
+ /Kids [3 0 R]
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Contents 5 0 R
+ /MediaBox [0 0 200 200]
+ /Parent 2 0 R
+ /Resources <<
+ /Pattern << /P0 4 0 R >>
+ >>
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Pattern
+ /PatternType 1
+ {{streamlen}}
+>>
+stream
+/T
+'
+endstream
+endobj
+{{object 5 0}} <<
+ {{streamlen}}
+>>
+stream
+/P0 scn
+re
+f
+endstream
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/bug_1294_expected.pdf.0.png b/testing/resources/pixel/bug_1294_expected.pdf.0.png
new file mode 100644
index 0000000..f97e340
--- /dev/null
+++ b/testing/resources/pixel/bug_1294_expected.pdf.0.png
Binary files differ