summaryrefslogtreecommitdiff
path: root/testing/tools/fixup_pdf_template.py
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-02-05 10:41:08 -0800
committerTom Sepez <tsepez@chromium.org>2015-02-05 10:41:08 -0800
commit219b3dab7e184bf8742f61527e37053b04903ff0 (patch)
tree8ce24202dc2fd5a61774c947e5eecf007bea6bf9 /testing/tools/fixup_pdf_template.py
parentdabc5d57bf473708295800a7991bc1fafdf76288 (diff)
downloadpdfium-219b3dab7e184bf8742f61527e37053b04903ff0.tar.xz
Fix segv in CPDF_DataAvail::CheckRoot() when /Root object is a string.
Handles the case of this malformed PDF without crashing. Note that to get a reproducible test case, a small fix is applied to our .py script which results in some whitespace/numbering difs across the resources (down the road, we ought to generate them on the fly in an intermediate directory). BUG=454695 R=jun_fang@foxitsoftware.com, thestig@chromium.org Review URL: https://codereview.chromium.org/895933003
Diffstat (limited to 'testing/tools/fixup_pdf_template.py')
-rwxr-xr-xtesting/tools/fixup_pdf_template.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/testing/tools/fixup_pdf_template.py b/testing/tools/fixup_pdf_template.py
index 873caeedde..87996a42cd 100755
--- a/testing/tools/fixup_pdf_template.py
+++ b/testing/tools/fixup_pdf_template.py
@@ -24,8 +24,10 @@ class TemplateProcessor:
XREF_TOKEN = '{{xref}}'
XREF_REPLACEMENT = 'xref\n%d %d\n'
- XREF_REPLACEMENT_N = '%010d %05d n\n'
- XREF_REPLACEMENT_F = '0000000000 65536 f\n'
+
+ # XREF rows must be exactly 20 bytes - space required.
+ XREF_REPLACEMENT_N = '%010d %05d n \n'
+ XREF_REPLACEMENT_F = '0000000000 65535 f \n'
STARTXREF_TOKEN= '{{startxref}}'
STARTXREF_REPLACEMENT = 'startxref\n%d'