fd29bb0c57
Xref offsets are relative to the start of the PDF data, not to the start of the PDF file. This is clear if you look at the other code: - In the XRef's readXRefTable and processXRefTable methods of XRef, the offset of a xref entry is set to the bytes as given by a PDF file. These values are always relative to the start of the PDF file (%PDF-). - The XRef's readXRef method adds the start offset of the stream to Xref entry's offset: "stream.pos = startXRef + stream.start". Clearly, this line assumes that the entry offset excludes the start offset. However, when the PDF is parsed in recovery mode, the xref table is filled with entries whose offset is relative to the start of the stream rather than the PDF file. This is incorrect, and the fix is to subtract the start offset of the stream from the entry's byte offset. The manually created PDF file serves as a regression test. It is a valid PDF, except: - The integer to point to the start of the xref table and the %%EOF trailer are missing. This will activate recovery mode in PDF.js - Some junk was added before the start of the PDF file. This exposes the bad offset bug.
149 lines
2.3 KiB
Plaintext
149 lines
2.3 KiB
Plaintext
*.pdf
|
|
*.error
|
|
|
|
!tracemonkey.pdf
|
|
!franz.pdf
|
|
!issue2391-1.pdf
|
|
!issue2391-2.pdf
|
|
!issue5801.pdf
|
|
!issue5972.pdf
|
|
!issue5874.pdf
|
|
!filled-background.pdf
|
|
!ArabicCIDTrueType.pdf
|
|
!ThuluthFeatures.pdf
|
|
!arial_unicode_ab_cidfont.pdf
|
|
!arial_unicode_en_cidfont.pdf
|
|
!asciihexdecode.pdf
|
|
!bug1050040.pdf
|
|
!canvas.pdf
|
|
!complex_ttf_font.pdf
|
|
!extgstate.pdf
|
|
!rotation.pdf
|
|
!simpletype3font.pdf
|
|
!sizes.pdf
|
|
!close-path-bug.pdf
|
|
!issue4630.pdf
|
|
!issue4909.pdf
|
|
!issue5202.pdf
|
|
!issue5280.pdf
|
|
!issue5677.pdf
|
|
!issue5954.pdf
|
|
!alphatrans.pdf
|
|
!devicen.pdf
|
|
!cmykjpeg.pdf
|
|
!issue840.pdf
|
|
!issue3438.pdf
|
|
!issue2074.pdf
|
|
!scan-bad.pdf
|
|
!bug847420.pdf
|
|
!bug860632.pdf
|
|
!bug894572.pdf
|
|
!bug911034.pdf
|
|
!bug1108301.pdf
|
|
!bug1157493.pdf
|
|
!pdfjsbad1586.pdf
|
|
!freeculture.pdf
|
|
!pdfkit_compressed.pdf
|
|
!TAMReview.pdf
|
|
!bug900822.pdf
|
|
!issue918.pdf
|
|
!issue1905.pdf
|
|
!issue2833.pdf
|
|
!issue2931.pdf
|
|
!issue3323.pdf
|
|
!issue4304.pdf
|
|
!issue4379.pdf
|
|
!issue4550.pdf
|
|
!bug1011159.pdf
|
|
!issue5734.pdf
|
|
!issue4875.pdf
|
|
!issue4881.pdf
|
|
!issue5994.pdf
|
|
!rotated.pdf
|
|
!issue1249.pdf
|
|
!issue1171.pdf
|
|
!smaskdim.pdf
|
|
!endchar.pdf
|
|
!type4psfunc.pdf
|
|
!issue1350.pdf
|
|
!S2.pdf
|
|
!glyph_accent.pdf
|
|
!personwithdog.pdf
|
|
!helloworld-bad.pdf
|
|
!zerowidthline.pdf
|
|
!bug868745.pdf
|
|
!mmtype1.pdf
|
|
!issue5704.pdf
|
|
!issue5751.pdf
|
|
!bug893730.pdf
|
|
!bug864847.pdf
|
|
!issue1002.pdf
|
|
!issue925.pdf
|
|
!issue2840.pdf
|
|
!issue4061.pdf
|
|
!issue4668.pdf
|
|
!issue5039.pdf
|
|
!issue5070.pdf
|
|
!issue5238.pdf
|
|
!issue5244.pdf
|
|
!issue5291.pdf
|
|
!issue5421.pdf
|
|
!issue5470.pdf
|
|
!issue5501.pdf
|
|
!issue5599.pdf
|
|
!issue5747.pdf
|
|
!issue6099.pdf
|
|
!gradientfill.pdf
|
|
!bug903856.pdf
|
|
!bug850854.pdf
|
|
!bug866395.pdf
|
|
!bug1027533.pdf
|
|
!bug1028735.pdf
|
|
!bug1046314.pdf
|
|
!bug1065245.pdf
|
|
!bug1151216.pdf
|
|
!bug1175962.pdf
|
|
!basicapi.pdf
|
|
!mixedfonts.pdf
|
|
!shading_extend.pdf
|
|
!noembed-identity.pdf
|
|
!noembed-identity-2.pdf
|
|
!noembed-jis7.pdf
|
|
!noembed-eucjp.pdf
|
|
!noembed-sjis.pdf
|
|
!vertical.pdf
|
|
!ZapfDingbats.pdf
|
|
!bug878026.pdf
|
|
!issue5010.pdf
|
|
!issue4934.pdf
|
|
!issue4650.pdf
|
|
!issue3025.pdf
|
|
!issue2099-1.pdf
|
|
!issue3371.pdf
|
|
!issue2956.pdf
|
|
!issue2537r.pdf
|
|
!bug946506.pdf
|
|
!issue3885.pdf
|
|
!bug859204.pdf
|
|
!issue4246.pdf
|
|
!issue4461.pdf
|
|
!issue4573.pdf
|
|
!issue4722.pdf
|
|
!issue4800.pdf
|
|
!issue4801.pdf
|
|
!issue5334.pdf
|
|
!issue5540.pdf
|
|
!issue5549.pdf
|
|
!issue5475.pdf
|
|
!annotation-border-styles.pdf
|
|
!issue5481.pdf
|
|
!issue5567.pdf
|
|
!issue5701.pdf
|
|
!issue5896.pdf
|
|
!issue5909.pdf
|
|
!issue6010_1.pdf
|
|
!issue6010_2.pdf
|
|
!issue6068.pdf
|
|
!issue6081.pdf
|
|
!issue6069.pdf
|