From ee44aef8d08d8f745380277412ec8bb420648a7c Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 5 Mar 2018 14:25:17 -0500 Subject: [PATCH] Treat loop in xref tables as damage (fixes #192) Prior to this fix, if there was a loop detected in following /Prev pointers in xref streams/tables, it would cause qpdf to lose data. Note that this condition causes many PDF readers to hang or fail. --- ChangeLog | 5 + libqpdf/QPDF.cc | 4 +- qpdf/qpdf.testcov | 1 + qpdf/qtest/qpdf.test | 13 +- qpdf/qtest/qpdf/append-xref-loop-fixed.pdf | Bin 0 -> 10282 bytes qpdf/qtest/qpdf/append-xref-loop.out | 4 + qpdf/qtest/qpdf/append-xref-loop.pdf | 1592 ++++++++++++++++++++ qpdf/qtest/qpdf/issue-149.out | 4 +- 8 files changed, 1620 insertions(+), 3 deletions(-) create mode 100644 qpdf/qtest/qpdf/append-xref-loop-fixed.pdf create mode 100644 qpdf/qtest/qpdf/append-xref-loop.out create mode 100644 qpdf/qtest/qpdf/append-xref-loop.pdf diff --git a/ChangeLog b/ChangeLog index e7a32833..bba500ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-03-05 Jay Berkenbilt + + * Improve handling of loops while following cross reference + tables. Fixes #192. + 2018-03-04 Jay Berkenbilt * 8.0.1: release diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 9e30d6db..90e90813 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -532,7 +532,9 @@ QPDF::read_xref(qpdf_offset_t xref_offset) } if (visited.count(xref_offset) != 0) { - xref_offset = 0; + QTC::TC("qpdf", "QPDF xref loop"); + throw QPDFExc(qpdf_e_damaged_pdf, this->m->file->getName(), "", 0, + "loop detected following xref tables"); } } diff --git a/qpdf/qpdf.testcov b/qpdf/qpdf.testcov index 7e60953e..5374302f 100644 --- a/qpdf/qpdf.testcov +++ b/qpdf/qpdf.testcov @@ -334,3 +334,4 @@ QPDFObjectHandle dictionary ignoring removereplace 0 QPDFObjectHandle numeric non-numeric 0 QPDFObjectHandle erase array bounds 0 qpdf-c called qpdf_check_pdf 0 +QPDF xref loop 0 diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test index 69d5a5de..877c3f5e 100644 --- a/qpdf/qtest/qpdf.test +++ b/qpdf/qtest/qpdf.test @@ -1400,7 +1400,7 @@ $td->runtest("C API: no recovery", show_ntests(); # ---------- $td->notify("--- Recovery Tests ---"); -$n_tests += @badfiles + 7; +$n_tests += @badfiles + 9; # Recovery tests. These are mostly after-the-fact -- when recovery # was implemented, some degree of recovery was possible on many of the @@ -1469,6 +1469,17 @@ $td->runtest("recoverable xref errors", $td->EXIT_STATUS => 3}, $td->NORMALIZE_NEWLINES); +$td->runtest("xref loop with append", + {$td->COMMAND => + "qpdf --deterministic-id append-xref-loop.pdf a.pdf"}, + {$td->FILE => "append-xref-loop.out", + $td->EXIT_STATUS => 3}, + $td->NORMALIZE_NEWLINES); + +$td->runtest("check output", + {$td->FILE => "a.pdf"}, + {$td->FILE => "append-xref-loop-fixed.pdf"}); + show_ntests(); # ---------- $td->notify("--- Basic Parsing Tests ---"); diff --git a/qpdf/qtest/qpdf/append-xref-loop-fixed.pdf b/qpdf/qtest/qpdf/append-xref-loop-fixed.pdf new file mode 100644 index 0000000000000000000000000000000000000000..81407215ebc24e70679a31d021604286f66418bb GIT binary patch literal 10282 zcmc&)OOM<{5Dp+j)Cew|cy|yh@e1Q^+ihD4t2{O%Hm{w`E(+3;gLkL1Of)+aX1vM5 zg$N-82QHjB@e5GIg%j5e5>j}DTcmKBf4~h<)g6yLE=wHZQSZUKTT@-%SLN<+y31bb zthA4cw|%zs(?8$+%LMoMXzMCFc8s?=>5e{^Zt1~<@~6pdF#E2UfatC{h^*% z^Mw1>XXE2*@cF4UO9!JJzP!xzu!j*bL>~FV-tL5Ng2BM>*Ioxdz`+03d20o(85d}a z<~)+z1E_$9LJuM4T*NHO*!W1}6XpZ0(GIlHIyt%}1MoID1VT=;a1Tf+FHFn_{(Q*L zGu9bH3ls)uy$qMU3RtAP3a3VU!;JeLZ=LP;upWV_U}&z&TqARh%{4Js;n`n!qq-be znqRi|!UhmFg0LZkjUj9hVWUVJMcOEkB}S1pinLLrjUsInX`@IRMcODp9mn}Lif^O% zHp*q*vNHi^(WF!Xj9ye=nCW2#bH`$~&g))3JvrJplf&Z*@{1A)6@_T-!3F|>ASAxs)V<^`MljwmGU& zt#AicTOCoVRqnv0a+@z*dgEM5x7h$tN-nkAY(@wr*hArV!qHr+RqxQHdYeret&&Ui zHXBAt$)$Rm%`2tkQoYSano@G9-eyxzDY;Z{bHJdKT&lM@>`+QB)!Q7rC?%KbZ4QBi zl5(lu=0Hj*xm0g+IHr_bs<%0)Q%Ww?+cXU*C70@L8W@z4OZ7JGk(|;wJ>1DYfJ^jp+pFz9s!T1M_JJV6g!B3_WZQ3oZclF@9 z&idOaZ=D_ja(}qPTbKI76T?ZrFkDD?p&Qs1(2U#L%1mnzdob|7ZN->arS@3f`PhW^ z%}N`*^nS)K&$?&jHbhe=Qye(}M_-+9l zu;&S|>7?X$y;0y_3*dLy3lzBAAZQf$&jPs3UZlX~HbA4mzZbx3>?I0ZKI}INT&(PS z@3WUFaQR5zB=Gllii}gnDRBAV-Y9Ts9baWfC~&SX*e%Y1L5v<=K!PIWX~b43a-DQF zgIwf1JbN`LcdmsJy#kEHcO?8cssD(+GEJ@g~Mo84cButhh>_&}{sD(+GEJ@hS8X-{& zldxN*<@{BRkf?=8*saoX{)Vj+3ELm*D-0g*E9T99xC%o!YF^H>l z>BR(BN_?N8;^)VNvkb8VRq<01$ydhM8?N{zv{t^rr#AC`zQj3Hu?6^2O2rn!TQgN# z=fc3CS&lM2H`*g6dcml3Ilky_aE}kld7q@BGYjQ38+m6`Mreuh@KA0~LCNvr^bO zuZ)f8yjO8VaT9pKr!qDYv@TK2yocLH@&#Ce5h;&iM0DOqF+R_p&m&3{!HB(tV8jw$ zMXQXBeQYMq$BP518!_BW;-`|*eapsae*mpMJhyg7BYZv1JS$!Af1*K0d24lrZyxib xtu);Bf?!*2X_anC?Z-(Psa~vmT3rd2|KG#BtTxHgab`ps7J*<(OQ+Y`>_3C{ac=+s literal 0 HcmV?d00001 diff --git a/qpdf/qtest/qpdf/append-xref-loop.out b/qpdf/qtest/qpdf/append-xref-loop.out new file mode 100644 index 00000000..c08d9fad --- /dev/null +++ b/qpdf/qtest/qpdf/append-xref-loop.out @@ -0,0 +1,4 @@ +WARNING: append-xref-loop.pdf: file is damaged +WARNING: append-xref-loop.pdf: loop detected following xref tables +WARNING: append-xref-loop.pdf: Attempting to reconstruct cross-reference table +qpdf: operation succeeded with warnings; resulting file may have some problems diff --git a/qpdf/qtest/qpdf/append-xref-loop.pdf b/qpdf/qtest/qpdf/append-xref-loop.pdf new file mode 100644 index 00000000..34809689 --- /dev/null +++ b/qpdf/qtest/qpdf/append-xref-loop.pdf @@ -0,0 +1,1592 @@ +%PDF-1.3 +%¿÷¢þ +%QDF-1.0 + +1 0 obj +<< + /PageLabels 107 0 R + /Pages 2 0 R + /Type /Catalog + /PageMode /UseOutlines + /Outlines 95 0 R +>> +endobj + +2 0 obj +<< + /Count 30 + /Kids [ + 3 0 R + 4 0 R + 5 0 R + 6 0 R + 7 0 R + 8 0 R + 9 0 R + 10 0 R + 11 0 R + 12 0 R + 13 0 R + 14 0 R + 15 0 R + 16 0 R + 17 0 R + 18 0 R + 19 0 R + 20 0 R + 21 0 R + 22 0 R + 23 0 R + 24 0 R + 25 0 R + 26 0 R + 27 0 R + 28 0 R + 29 0 R + 30 0 R + 31 0 R + 32 0 R + ] + /Type /Pages +>> +endobj + +%% Page 1 +3 0 obj +<< + /Contents 33 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 2 +4 0 obj +<< + /Contents 37 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 3 +5 0 obj +<< + /Contents 39 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 4 +6 0 obj +<< + /Contents 41 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 5 +7 0 obj +<< + /Contents 43 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 6 +8 0 obj +<< + /Contents 45 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 7 +9 0 obj +<< + /Contents 47 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 8 +10 0 obj +<< + /Contents 49 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 9 +11 0 obj +<< + /Contents 51 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 10 +12 0 obj +<< + /Contents 53 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 11 +13 0 obj +<< + /Contents 55 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 12 +14 0 obj +<< + /Contents 57 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 13 +15 0 obj +<< + /Contents 59 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 14 +16 0 obj +<< + /Contents 61 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 15 +17 0 obj +<< + /Contents 63 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 16 +18 0 obj +<< + /Contents 65 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 17 +19 0 obj +<< + /Contents 67 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 18 +20 0 obj +<< + /Contents 69 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 19 +21 0 obj +<< + /Contents 71 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 20 +22 0 obj +<< + /Contents 73 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 21 +23 0 obj +<< + /Contents 75 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 22 +24 0 obj +<< + /Contents 77 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 23 +25 0 obj +<< + /Contents 79 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 24 +26 0 obj +<< + /Contents 81 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 25 +27 0 obj +<< + /Contents 83 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 26 +28 0 obj +<< + /Contents 85 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 27 +29 0 obj +<< + /Contents 87 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 28 +30 0 obj +<< + /Contents 89 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 29 +31 0 obj +<< + /Contents 91 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Page 30 +32 0 obj +<< + /Contents 93 0 R + /MediaBox [ + 0 + 0 + 612 + 792 + ] + /Parent 2 0 R + /Resources << + /Font << + /F1 35 0 R + >> + /ProcSet 36 0 R + >> + /Type /Page +>> +endobj + +%% Contents for page 1 +33 0 obj +<< + /Length 34 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 0) Tj +ET +endstream +endobj + +34 0 obj +46 +endobj + +35 0 obj +<< + /BaseFont /Helvetica + /Encoding /WinAnsiEncoding + /Name /F1 + /Subtype /Type1 + /Type /Font +>> +endobj + +36 0 obj +[ + /PDF + /Text +] +endobj + +%% Contents for page 2 +37 0 obj +<< + /Length 38 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 1) Tj +ET +endstream +endobj + +38 0 obj +46 +endobj + +%% Contents for page 3 +39 0 obj +<< + /Length 40 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 2) Tj +ET +endstream +endobj + +40 0 obj +46 +endobj + +%% Contents for page 4 +41 0 obj +<< + /Length 42 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 3) Tj +ET +endstream +endobj + +42 0 obj +46 +endobj + +%% Contents for page 5 +43 0 obj +<< + /Length 44 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 4) Tj +ET +endstream +endobj + +44 0 obj +46 +endobj + +%% Contents for page 6 +45 0 obj +<< + /Length 46 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 5) Tj +ET +endstream +endobj + +46 0 obj +46 +endobj + +%% Contents for page 7 +47 0 obj +<< + /Length 48 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 6) Tj +ET +endstream +endobj + +48 0 obj +46 +endobj + +%% Contents for page 8 +49 0 obj +<< + /Length 50 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 7) Tj +ET +endstream +endobj + +50 0 obj +46 +endobj + +%% Contents for page 9 +51 0 obj +<< + /Length 52 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 8) Tj +ET +endstream +endobj + +52 0 obj +46 +endobj + +%% Contents for page 10 +53 0 obj +<< + /Length 54 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 9) Tj +ET +endstream +endobj + +54 0 obj +46 +endobj + +%% Contents for page 11 +55 0 obj +<< + /Length 56 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 10) Tj +ET +endstream +endobj + +56 0 obj +47 +endobj + +%% Contents for page 12 +57 0 obj +<< + /Length 58 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 11) Tj +ET +endstream +endobj + +58 0 obj +47 +endobj + +%% Contents for page 13 +59 0 obj +<< + /Length 60 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 12) Tj +ET +endstream +endobj + +60 0 obj +47 +endobj + +%% Contents for page 14 +61 0 obj +<< + /Length 62 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 13) Tj +ET +endstream +endobj + +62 0 obj +47 +endobj + +%% Contents for page 15 +63 0 obj +<< + /Length 64 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 14) Tj +ET +endstream +endobj + +64 0 obj +47 +endobj + +%% Contents for page 16 +65 0 obj +<< + /Length 66 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 15) Tj +ET +endstream +endobj + +66 0 obj +47 +endobj + +%% Contents for page 17 +67 0 obj +<< + /Length 68 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 16) Tj +ET +endstream +endobj + +68 0 obj +47 +endobj + +%% Contents for page 18 +69 0 obj +<< + /Length 70 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 17) Tj +ET +endstream +endobj + +70 0 obj +47 +endobj + +%% Contents for page 19 +71 0 obj +<< + /Length 72 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 18) Tj +ET +endstream +endobj + +72 0 obj +47 +endobj + +%% Contents for page 20 +73 0 obj +<< + /Length 74 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 19) Tj +ET +endstream +endobj + +74 0 obj +47 +endobj + +%% Contents for page 21 +75 0 obj +<< + /Length 76 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 20) Tj +ET +endstream +endobj + +76 0 obj +47 +endobj + +%% Contents for page 22 +77 0 obj +<< + /Length 78 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 21) Tj +ET +endstream +endobj + +78 0 obj +47 +endobj + +%% Contents for page 23 +79 0 obj +<< + /Length 80 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 22) Tj +ET +endstream +endobj + +80 0 obj +47 +endobj + +%% Contents for page 24 +81 0 obj +<< + /Length 82 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 23) Tj +ET +endstream +endobj + +82 0 obj +47 +endobj + +%% Contents for page 25 +83 0 obj +<< + /Length 84 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 24) Tj +ET +endstream +endobj + +84 0 obj +47 +endobj + +%% Contents for page 26 +85 0 obj +<< + /Length 86 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 25) Tj +ET +endstream +endobj + +86 0 obj +47 +endobj + +%% Contents for page 27 +87 0 obj +<< + /Length 88 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 26) Tj +ET +endstream +endobj + +88 0 obj +47 +endobj + +%% Contents for page 28 +89 0 obj +<< + /Length 90 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 27) Tj +ET +endstream +endobj + +90 0 obj +47 +endobj + +%% Contents for page 29 +91 0 obj +<< + /Length 92 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 28) Tj +ET +endstream +endobj + +92 0 obj +47 +endobj + +%% Contents for page 30 +93 0 obj +<< + /Length 94 0 R +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 29) Tj +ET +endstream +endobj + +94 0 obj +47 +endobj + +95 0 obj +<< + /Type /Outlines + /First 96 0 R + /Last 97 0 R + /Count 6 +>> +endobj + +96 0 obj +<< + /Type /Outline + /Title (Isís 1 -> 5: /XYZ null null null) + /Parent 95 0 R + /Count 4 + /Next 97 0 R + /First 98 0 R + /Last 99 0 R + /Dest [ 8 0 R /XYZ null null null ] +>> +endobj + +97 0 obj +<< + /Type /Outline + /Title (Trepak 2 -> 15: /XYZ 66 756 3) + /Parent 95 0 R + /Prev 96 0 R + /Dest [ 18 0 R /XYZ 66 756 3 ] +>> +endobj + +98 0 obj +<< + /Type /Outline + /Title (Amanda 1.1 -> 11: /Fit) + /Parent 96 0 R + /Next 99 0 R + /First 100 0 R + /Last 101 0 R + /Count -3 + /Dest [ 14 0 R /Fit ] +>> +endobj + +99 0 obj +<< + /Type /Outline + % /Title (Sandy (Sandy [Greek]) 1.2 -> 13: /FitH 792) + /Title + /Parent 96 0 R + /Prev 98 0 R + /First 105 0 R + /Last 106 0 R + /Count 2 + /Dest [ 16 0 R /FitH 792 ] +>> +endobj + +100 0 obj +<< + /Type /Outline + /Title (Isosicle 1.1.1 -> 12: /FitV 100) + /Parent 98 0 R + /Next 101 0 R + /First 102 0 R + /Last 103 0 R + /Count -2 + /Dest [ 15 0 R /FitV 100 ] +>> +endobj + +101 0 obj +<< + /Type /Outline + /Title (Isosicle 1.1.2 -> 12: /XYZ null null null) + /Parent 98 0 R + /Prev 100 0 R + /First 104 0 R + /Last 104 0 R + /Count 1 + /Dest [ 15 0 R /XYZ null null null ] +>> +endobj + +102 0 obj +<< + /Type /Outline + /Title (Isosicle 1.1.1.1 -> 18: /XYZ null null null) + /Parent 100 0 R + /Next 103 0 R + /Dest [ 21 0 R /XYZ null null null ] +>> +endobj + +103 0 obj +<< + /Type /Outline + /Title (Isosicle 1.1.1.2 -> 19: /XYZ null null null) + /Parent 100 0 R + /Prev 102 0 R + /Dest [ 22 0 R /XYZ null null null ] +>> +endobj + +104 0 obj +<< + /Type /Outline + /Title (Isosicle 1.1.2.1 -> 22: /XYZ null null null) + /Parent 101 0 R + /Dest [ 25 0 R /XYZ null null null ] +>> +endobj + +105 0 obj +<< + /Type /Outline + /Title (Trepsichord 1.2.1 -> 1: /FitR 66 714 180 770) + /Parent 99 0 R + /Next 106 0 R + /Dest [ 4 0 R /FitR 66 714 180 770 ] +>> +endobj + +106 0 obj +<< + /Type /Outline + /Title (Trepsicle 1.2.2 -> 0: /XYZ null null null) + /Parent 99 0 R + /Prev 105 0 R + /Dest [ 3 0 R /XYZ null null null ] +>> +endobj + +107 0 obj + << /Nums [ + 0 << /P () >> + 2 << /S /r /St 1 >> + 7 << /P () >> + 9 << /S /r /St 6 >> + 11 << /P () >> + 12 << /S /D /St 2 >> + 15 << /S /D /St 6 >> + 19 << /P () >> + 20 << /S /D /St 12 >> + 22 << /S /D /St 16059 >> + 23 << /S /r /St 50 >> + 29 << /S /r /St 54 >> + ] >> +endobj + +xref +0 108 +0000000000 65535 f +0000000025 00000 n +0000000145 00000 n +0000000541 00000 n +0000000746 00000 n +0000000951 00000 n +0000001156 00000 n +0000001361 00000 n +0000001566 00000 n +0000001771 00000 n +0000001976 00000 n +0000002182 00000 n +0000002389 00000 n +0000002596 00000 n +0000002803 00000 n +0000003010 00000 n +0000003217 00000 n +0000003424 00000 n +0000003631 00000 n +0000003838 00000 n +0000004045 00000 n +0000004252 00000 n +0000004459 00000 n +0000004666 00000 n +0000004873 00000 n +0000005080 00000 n +0000005287 00000 n +0000005494 00000 n +0000005701 00000 n +0000005908 00000 n +0000006115 00000 n +0000006322 00000 n +0000006529 00000 n +0000006748 00000 n +0000006851 00000 n +0000006871 00000 n +0000006990 00000 n +0000007049 00000 n +0000007152 00000 n +0000007195 00000 n +0000007298 00000 n +0000007341 00000 n +0000007444 00000 n +0000007487 00000 n +0000007590 00000 n +0000007633 00000 n +0000007736 00000 n +0000007779 00000 n +0000007882 00000 n +0000007925 00000 n +0000008028 00000 n +0000008071 00000 n +0000008174 00000 n +0000008218 00000 n +0000008321 00000 n +0000008365 00000 n +0000008469 00000 n +0000008513 00000 n +0000008617 00000 n +0000008661 00000 n +0000008765 00000 n +0000008809 00000 n +0000008913 00000 n +0000008957 00000 n +0000009061 00000 n +0000009105 00000 n +0000009209 00000 n +0000009253 00000 n +0000009357 00000 n +0000009401 00000 n +0000009505 00000 n +0000009549 00000 n +0000009653 00000 n +0000009697 00000 n +0000009801 00000 n +0000009845 00000 n +0000009949 00000 n +0000009993 00000 n +0000010097 00000 n +0000010141 00000 n +0000010245 00000 n +0000010289 00000 n +0000010393 00000 n +0000010437 00000 n +0000010541 00000 n +0000010585 00000 n +0000010689 00000 n +0000010733 00000 n +0000010837 00000 n +0000010881 00000 n +0000010985 00000 n +0000011029 00000 n +0000011133 00000 n +0000011177 00000 n +0000011281 00000 n +0000011301 00000 n +0000011388 00000 n +0000011584 00000 n +0000011730 00000 n +0000011905 00000 n +0000012258 00000 n +0000012449 00000 n +0000012659 00000 n +0000012828 00000 n +0000012997 00000 n +0000013150 00000 n +0000013319 00000 n +0000013484 00000 n +trailer << + /Root 1 0 R + /Size 108 +>> +startxref +13801 +%%EOF + +% 1. Delete page labels +xref +0 1 +0000000107 65535 f +107 1 +0000000000 00001 f +trailer << /Root 1 0 R /Size 108 /Prev 13801 >> +startxref +16059 +%%EOF + +% 2. Delete outlines, reuse page labels. + +107 1 obj + << /Nums [ + 0 << /P () >> + 2 << /S /D /St 1 >> + 7 << /P () >> + 9 << /S /R /St 6 >> + 11 << /P () >> + 12 << /S /r /St 2 >> + 15 << /S /r /St 6 >> + 19 << /P () >> + 20 << /S /R /St 12 >> + 22 << /S /D /St 16059 >> + 23 << /S /r /St 50 >> + 29 << /S /r /St 54 >> + ] >> +endobj + +% Reuse object 1 with the same generation number. Leave outlines +% there pointing to a deleted object. +1 0 obj +<< + /PageLabels 107 1 R + /Pages 2 0 R + /Type /Catalog + /PageMode /UseOutlines + /Outlines 95 0 R +>> +endobj + +% Reuse object 33 to replace contents for page 1 +33 0 obj +<< + /Length 50 +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato 0 new) Tj +ET +endstream +endobj + +% Delete object 34 + +xref +0 2 +0000000034 65535 f +0000016648 00000 n +33 2 +0000016817 00000 n +0000000095 00001 f +95 13 +0000000096 00001 f +0000000097 00001 f +0000000098 00001 f +0000000099 00001 f +0000000100 00001 f +0000000101 00001 f +0000000102 00001 f +0000000103 00001 f +0000000104 00001 f +0000000105 00001 f +0000000106 00001 f +0000000000 00001 f +0000016227 00001 n +trailer << /Size 108 /Prev 16940 /Root 1 0 R >> +startxref +16940 +%%EOF diff --git a/qpdf/qtest/qpdf/issue-149.out b/qpdf/qtest/qpdf/issue-149.out index 5c473389..d26ce6b6 100644 --- a/qpdf/qtest/qpdf/issue-149.out +++ b/qpdf/qtest/qpdf/issue-149.out @@ -1,2 +1,4 @@ -WARNING: issue-149.pdf: reported number of objects (11) inconsistent with actual number of objects (7) +WARNING: issue-149.pdf: file is damaged +WARNING: issue-149.pdf: loop detected following xref tables +WARNING: issue-149.pdf: Attempting to reconstruct cross-reference table qpdf: operation succeeded with warnings; resulting file may have some problems