Commit f0ded6bca881f26b4a12df551f7652ee175ad844
1 parent
edf3509b
Add test case for self-referential object streams
Previous test case was lost in #1221. Test file was created from object-stream.pdf by adding a reference to itself into object stream 1 0.
Showing
7 changed files
with
21 additions
and
1 deletions
ChangeLog
| ... | ... | @@ -17,6 +17,11 @@ |
| 17 | 17 | * Add static option to Pl_DCT to control whether decompression of |
| 18 | 18 | corrupt JPEG data is attempted. |
| 19 | 19 | |
| 20 | +2024-07-01 M Holger <m.holger@qpdf.org> | |
| 21 | + | |
| 22 | + * Bug fix: certain invalid object streams caused the insertion of | |
| 23 | + invalid entries into in the xref table. | |
| 24 | + | |
| 20 | 25 | 2024-06-29 M Holger <m.holger@qpdf.org> |
| 21 | 26 | |
| 22 | 27 | * Bug fix: in QPDFOutlineObjectHelper detect loops in the list of | ... | ... |
libqpdf/QPDF.cc
| ... | ... | @@ -1938,6 +1938,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number) |
| 1938 | 1938 | continue; |
| 1939 | 1939 | } |
| 1940 | 1940 | if (num == obj_stream_number) { |
| 1941 | + QTC::TC("qpdf", "QPDF ignore self-referential object stream"); | |
| 1941 | 1942 | warn(damagedPDF( |
| 1942 | 1943 | input, |
| 1943 | 1944 | m->last_object_description, | ... | ... |
qpdf/qpdf.testcov
qpdf/qtest/object-stream.test
| ... | ... | @@ -16,7 +16,7 @@ cleanup(); |
| 16 | 16 | |
| 17 | 17 | my $td = new TestDriver('object-stream'); |
| 18 | 18 | |
| 19 | -my $n_tests = 7 + (36 * 4) + (12 * 2); | |
| 19 | +my $n_tests = 9 + (36 * 4) + (12 * 2); | |
| 20 | 20 | my $n_compare_pdfs = 36; |
| 21 | 21 | |
| 22 | 22 | for (my $n = 16; $n <= 19; ++$n) |
| ... | ... | @@ -107,5 +107,16 @@ $td->runtest("check file", |
| 107 | 107 | {$td->FILE => "a.pdf"}, |
| 108 | 108 | {$td->FILE => "recover-xref-stream-recovered.pdf"}); |
| 109 | 109 | |
| 110 | +# Self-referential object stream | |
| 111 | +$td->runtest("self-referential object stream", | |
| 112 | + {$td->COMMAND => "qpdf --static-id --qdf" . | |
| 113 | + " object-stream-self-ref.pdf a.pdf"}, | |
| 114 | + {$td->FILE => "object-stream-self-ref.out", $td->EXIT_STATUS => 3}, | |
| 115 | + $td->NORMALIZE_NEWLINES); | |
| 116 | +$td->runtest("check file", | |
| 117 | + {$td->FILE => "a.pdf"}, | |
| 118 | + {$td->FILE => "object-stream-self-ref.out.pdf"}); | |
| 119 | + | |
| 120 | + | |
| 110 | 121 | cleanup(); |
| 111 | 122 | $td->report(calc_ntests($n_tests, $n_compare_pdfs)); | ... | ... |
qpdf/qtest/qpdf/object-stream-self-ref.out
0 โ 100644
qpdf/qtest/qpdf/object-stream-self-ref.out.pdf
0 โ 100644
No preview for this file type
qpdf/qtest/qpdf/object-stream-self-ref.pdf
0 โ 100644
No preview for this file type