diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-02 09:31:14 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-02 09:31:14 -0700 |
commit | e140dc386da5ceb3cbf87d24ecb9377eac5f6b30 (patch) | |
tree | f6820a7b6235a9c810ee3647e511da0ed5a71db9 /testing/resources/pixel | |
parent | 436977e14b616facb2b950cba9ed9467aa617e6e (diff) | |
download | pdfium-e140dc386da5ceb3cbf87d24ecb9377eac5f6b30.tar.xz |
Merge to XFA: Add test case for parsing endobj keywords.
(cherry picked from commit 5bd88ec07e79215400777f3095c6843e0627cade)
Original Review URL: https://codereview.chromium.org/1232803005 .
BUG=493126
R=thestig@chromium.org
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1237713004 .
Diffstat (limited to 'testing/resources/pixel')
26 files changed, 789 insertions, 0 deletions
diff --git a/testing/resources/pixel/endobj1.in b/testing/resources/pixel/endobj1.in new file mode 100644 index 0000000000..3e7f5e6bc5 --- /dev/null +++ b/testing/resources/pixel/endobj1.in @@ -0,0 +1,60 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 1: +% /Length identifies intended end of stream, despite embedded keywords. +% Both should render as text. +{{object 6 0}} << + /Length 97 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is text per /Length) Tj +ET +endstream +endobj +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj10.in b/testing/resources/pixel/endobj10.in new file mode 100644 index 0000000000..d89132a97c --- /dev/null +++ b/testing/resources/pixel/endobj10.in @@ -0,0 +1,59 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 10: +% /Length identifies end of stream, and embedded endstream/endobj +% keyword to trip us up, but missing endstream keyword. +{{object 6 0}} << + /Length 97 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endstream is not text) Tj +0 50 Td +/F2 13 Tf +(endobj is not text) Tj +ET +endobj +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj10_expected.pdf.0.png b/testing/resources/pixel/endobj10_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj10_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj11.in b/testing/resources/pixel/endobj11.in new file mode 100644 index 0000000000..6bccbe5f0e --- /dev/null +++ b/testing/resources/pixel/endobj11.in @@ -0,0 +1,65 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 11: +% /Length points past intended end of stream, with embedded keywords. +% Both should render as text. +{{object 6 0}} << + /Length 128 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is text per /Length) Tj +ET +endstream +endobj + +% blah blah blah. +% blah blah blah. +% blah blah blah. + +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj11_expected.pdf.0.png b/testing/resources/pixel/endobj11_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj11_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj12.in b/testing/resources/pixel/endobj12.in new file mode 100644 index 0000000000..1a89b31650 --- /dev/null +++ b/testing/resources/pixel/endobj12.in @@ -0,0 +1,65 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 11: +% /Length points well past intended end of stream, with embedded keywords. +% Both should render as text. +{{object 6 0}} << + /Length 210 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is text per /Length) Tj +ET +endstream +endobj + +% blah blah blah. +% blah blah blah. +% blah blah blah. + +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj12_expected.pdf.0.png b/testing/resources/pixel/endobj12_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj12_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj13.in b/testing/resources/pixel/endobj13.in new file mode 100644 index 0000000000..81623a2b03 --- /dev/null +++ b/testing/resources/pixel/endobj13.in @@ -0,0 +1,65 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 11: +% /Length points well past EOF, with embedded keywords. +% Both should render as text. +{{object 6 0}} << + /Length 1000 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is text per /Length) Tj +ET +endstream +endobj + +% blah blah blah. +% blah blah blah. +% blah blah blah. + +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj13_expected.pdf.0.png b/testing/resources/pixel/endobj13_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj13_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj1_expected.pdf.0.png b/testing/resources/pixel/endobj1_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..a044bb0c37 --- /dev/null +++ b/testing/resources/pixel/endobj1_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj2.in b/testing/resources/pixel/endobj2.in new file mode 100644 index 0000000000..341fe7edb3 --- /dev/null +++ b/testing/resources/pixel/endobj2.in @@ -0,0 +1,59 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 4: +% /Length identifies intended end of stream, but whitespace rather than +% newline following the stream keyword. +{{object 6 0}} << + /Length 97 +>> +stream BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is text per /Length) Tj +ET +endstream +endobj +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj2_expected.pdf.0.png b/testing/resources/pixel/endobj2_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj2_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj3.in b/testing/resources/pixel/endobj3.in new file mode 100644 index 0000000000..11f5a99480 --- /dev/null +++ b/testing/resources/pixel/endobj3.in @@ -0,0 +1,59 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 3: +% /Length identifies intended end of stream, but whitespace rather than +% newline following the endstream keyword. +{{object 6 0}} << + /Length 97 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is text per /Length) Tj +ET +endstream endobj +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj3_expected.pdf.0.png b/testing/resources/pixel/endobj3_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..a044bb0c37 --- /dev/null +++ b/testing/resources/pixel/endobj3_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj4.in b/testing/resources/pixel/endobj4.in new file mode 100644 index 0000000000..a49a5c2775 --- /dev/null +++ b/testing/resources/pixel/endobj4.in @@ -0,0 +1,59 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 5: +% /Length identifies intended end of stream, but whitespace rather than +% newline following the endobj keyword. +{{object 6 0}} << + /Length 97 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is text per /Length) Tj +ET +endstream +endobj {{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj4_expected.pdf.0.png b/testing/resources/pixel/endobj4_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..a044bb0c37 --- /dev/null +++ b/testing/resources/pixel/endobj4_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj5.in b/testing/resources/pixel/endobj5.in new file mode 100644 index 0000000000..dce87954ec --- /dev/null +++ b/testing/resources/pixel/endobj5.in @@ -0,0 +1,60 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 5: +% /Length incorrectly identifies middle of stream, no confusing +% keywords to trip us up. +{{object 6 0}} << + /Length 50 +>> +stream +BT +20 50 Td +/F1 12 Tf +(xxxxxx is text) Tj +0 50 Td +/F2 13 Tf +(yyyyyyyyy after bad /Length) Tj +ET +endstream +endobj +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj5_expected.pdf.0.png b/testing/resources/pixel/endobj5_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..87f2a9b32d --- /dev/null +++ b/testing/resources/pixel/endobj5_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj6.in b/testing/resources/pixel/endobj6.in new file mode 100644 index 0000000000..53f546f519 --- /dev/null +++ b/testing/resources/pixel/endobj6.in @@ -0,0 +1,60 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 6: +% /Length incorrectly identifies middle of stream, and confusing +% keywords to trip us up. Should only render |endobj| as text. +{{object 6 0}} << + /Length 50 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream after bad /Length) Tj +ET +endstream +endobj +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj6_expected.pdf.0.png b/testing/resources/pixel/endobj6_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj6_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj7.in b/testing/resources/pixel/endobj7.in new file mode 100644 index 0000000000..747514fa80 --- /dev/null +++ b/testing/resources/pixel/endobj7.in @@ -0,0 +1,60 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 7: +% /Length identifies intended end of stream, but endstream/endobj +% keywords swapped. Should render |endobj| and |endstream| as text. +{{object 6 0}} << + /Length 97 +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is text per /Length) Tj +ET +endobj +endstream +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj7_expected.pdf.0.png b/testing/resources/pixel/endobj7_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj7_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj8.in b/testing/resources/pixel/endobj8.in new file mode 100644 index 0000000000..66892e239a --- /dev/null +++ b/testing/resources/pixel/endobj8.in @@ -0,0 +1,59 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 8: +% No /Length to identify end of stream, but embedded endobj/endstream +% keywords to trip us up. Should only render |endobj| as text. +{{object 6 0}} << +>> +stream +BT +20 50 Td +/F1 12 Tf +(endobj is text) Tj +0 50 Td +/F2 13 Tf +(endstream is not text) Tj +ET +endstream +endobj +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj8_expected.pdf.0.png b/testing/resources/pixel/endobj8_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj8_expected.pdf.0.png diff --git a/testing/resources/pixel/endobj9.in b/testing/resources/pixel/endobj9.in new file mode 100644 index 0000000000..fb156faa9f --- /dev/null +++ b/testing/resources/pixel/endobj9.in @@ -0,0 +1,59 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +{{object 2 0}} << + /Type /Pages + /MediaBox [ 0 0 200 200 ] + /Count 1 + /Kids [ 3 0 R ] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Resources << + /Font << + /F1 4 0 R + /F2 5 0 R + >> + >> + /Contents 6 0 R +>> +endobj +{{object 4 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Times-Roman +>> +endobj +{{object 5 0}} << + /Type /Font + /Subtype /Type1 + /BaseFont /Helvetica +>> +endobj +% Case 9: +% No /Length to identify end of stream, but embedded endstream/endobj +% keyword to trip us up. Should render nothing as text. +{{object 6 0}} << +>> +stream +BT +20 50 Td +/F1 12 Tf +(endstream is not text) Tj +0 50 Td +/F2 13 Tf +(endobj is not text) Tj +ET +endstream +endobj +{{xref}} +trailer << + /Size 6 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/pixel/endobj9_expected.pdf.0.png b/testing/resources/pixel/endobj9_expected.pdf.0.png Binary files differnew file mode 100644 index 0000000000..3edcc2db89 --- /dev/null +++ b/testing/resources/pixel/endobj9_expected.pdf.0.png |