From 290c9541deb4931ff7c7a32765482db4e09c8d85 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 19 Mar 2024 08:26:43 -0400 Subject: [PATCH] Tests/LibPDF: Add a test for resolving indirect refs during parsing This test uses a JBIG2Globals with an indirect reference, and contains an indirect reference for a stream length. When we parse the main JBIG2 image's stream, we unfilter its data, which causes these two indirect references to be resolved during parsing. I started with the output of Meta/jbig2_to_pdf.py -o foo.pdf \ Tests/LibGfx/test-inputs/jbig2/bitmap.jbig2 and then manually added a /DecodeParms <> entry pointing to an empty stream, and made that new stream object's length an indirect reference too for good measure. I used `mutool clean` to fix up offsets a bit. But that also removes the indirect reference for a stream's length, so I manually put that back in and adjusted the offset to the last object in the xref table and the startxref value. --- Tests/LibPDF/jbig2-globals.pdf | Bin 0 -> 1090 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Tests/LibPDF/jbig2-globals.pdf diff --git a/Tests/LibPDF/jbig2-globals.pdf b/Tests/LibPDF/jbig2-globals.pdf new file mode 100644 index 0000000000000000000000000000000000000000..131b0febbfa0ea095dc610af43deb092bd7c137c GIT binary patch literal 1090 zcmY!laBVf>eFy#FE6E{B-?*#Prl+1tSFm zg&;dSuGG8~kRmP+AH;yE2CLHd&P*weHU=q;)pyP>%_~tbMA8G2K-Z%mkXV$OR{}9# z-#0ZSGtnu(BHBQ~K*8A3Qo+Q)0Ax~LNorn6v4RQ6Wc{Gj;{4L0KQE)+Ga;m;dYFTD-s(VplrM_EcPDyH!zL%4yyOB$3a(+sxzEfsNaX@O3bAE0? zejX@<4D}&00f|MqAg_ZJyXWL5CFT?>n8Cab^BDsJ1A_qrBLf42FarZ)KLZ2f1dtF2 zg9I5E7}deDztLrxIGF$c{m=C8-@k1KQy%N!1PiwXQ6j5E_ev!41 zE1}MGW|gL@ahPk-oxNrnLhbAK3-R>lY37c2oSK({mP9}bKw1ny#(@}I6-B9OTm}jjTn2EUU}kD+ zY^IQ=02ebfQvk~<