2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Merge pull request #1169 from m-holger/xref_test

Add bad xref table test
This commit is contained in:
Jay Berkenbilt 2024-04-28 14:45:58 -04:00 committed by GitHub
commit a1fe40a4f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 110 additions and 1 deletions

View File

@ -0,0 +1,104 @@
%PDF-1.3
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 612 792]
/Contents 4 0 R
/Resources <<
/ProcSet 5 0 R
/Font <<
/F1 6 0 R
>>
>>
>>
endobj
4 0 obj
<<
/Length 44
>>
stream
BT
/F1 24 Tf
72 720 Td
(Potato) Tj
ET
endstream
endobj
5 0 obj
[
/PDF
/Text
]
endobj
6 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
>>
endobj
xref
0 7
0000000000 65535 f don't panick
0000000009 00000 n life is too short
0000000063 00000 n
0000000135 00000 n
0000000307 00000 n
0000000403 00000 n
0000000438 00000 n
trailer <<
/Size 7
/Root 1 0 R
>>
startxref
556
%%EOF

View File

@ -14,7 +14,7 @@ cleanup();
my $td = new TestDriver('xref-errors'); my $td = new TestDriver('xref-errors');
my $n_tests = 6; my $n_tests = 7;
# Handle file with invalid xref table and object 0 as a regular object # Handle file with invalid xref table and object 0 as a regular object
# (bug 3159950). # (bug 3159950).
@ -62,5 +62,10 @@ $td->runtest("out of range in deleted object",
{$td->FILE => "xref-range.out", $td->EXIT_STATUS => 0}, {$td->FILE => "xref-range.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES); $td->NORMALIZE_NEWLINES);
$td->runtest("extra text in xref table",
{$td->COMMAND => "qpdf --check bad-xref.pdf"},
{$td->STRING => "", $td->EXIT_STATUS => 3},
$td->EXPECT_FAILURE);
cleanup(); cleanup();
$td->report($n_tests); $td->report($n_tests);