summaryrefslogtreecommitdiff
path: root/testing/resources/bug_896366.in
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-18 17:46:52 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-18 17:46:52 +0000
commit0233af4f241c712b41a5d5dfc337cdfce8c63bc9 (patch)
treeec353562109786de34b60362bccfd4d76435cdfe /testing/resources/bug_896366.in
parent2486456feae06bd0dd2254f1569cf2cfb8d04104 (diff)
downloadpdfium-0233af4f241c712b41a5d5dfc337cdfce8c63bc9.tar.xz
Push/pop the graphics state stack when flattening.
When FPDFPage_Flatten() manipulates a content stream, it replaces the content stream with a content stream array. The first element in the array is the original content stream and the second element in the array is the flattened annotations content. To make sure the original content stream's graphics state stack does not affect the flattened annotations, FPDFPage_Flatten() rewrites the original content stream to be: q $contents Q When FPDFPage_Flatten() manipulates a content stream array, it just appends the flattened annotations as a new element in the array. This may result in graphics state stack leaking out. To fix this, wrap the content stream array to be: ["q", $content1, ..., $contentN, "Q"] And then append the flattened annotations. BUG=chromium:896366 Change-Id: Ic6499e39eb4c9f1fe45d037622bf02be724b6cae Reviewed-on: https://pdfium-review.googlesource.com/c/44252 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'testing/resources/bug_896366.in')
-rw-r--r--testing/resources/bug_896366.in60
1 files changed, 60 insertions, 0 deletions
diff --git a/testing/resources/bug_896366.in b/testing/resources/bug_896366.in
new file mode 100644
index 0000000000..86bd6fee32
--- /dev/null
+++ b/testing/resources/bug_896366.in
@@ -0,0 +1,60 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+ /AcroForm <<
+ /Fields [4 0 R]
+ >>
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /Kids [3 0 R]
+ /Count 1
+>>
+endobj
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Annots [4 0 R]
+ /Contents [6 0 R]
+ /MediaBox [0 0 612 792]
+>>
+endobj
+{{object 4 0}} <<
+ /Type /Annot
+ /Subtype /Widget
+ /F 4
+ /FT /Btn
+ /Rect [ 75 80 125 120 ]
+ /T (PushButton)
+ /Ff 65536
+ /H
+ /P
+ /AP << /N 5 0 R >>
+ /MK << /BG [ 1.0 0.0 0.0 ] >>
+>>
+endobj
+{{object 5 0}} <<
+ /Subtype /Form
+ /BBox [ 0 40 50 00 ]
+ {{streamlen}}
+>>
+stream
+q
+0 0 1 rg
+0 0 50 40 re B*
+Q
+endstream
+endobj
+{{object 6 0}} <<
+ {{streamlen}}
+>>
+stream
+1 0 0 -1 0 792 cm
+endstream
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF