ladybird/Userland/Libraries/LibPDF
Nico Weber 0374c1eb3b LibPDF: Handle indirect reference resolving during parsing more robustly
If `Document::resolve()` was called during parsing, it'd change the
reader's current position, so the parsing code that called it would
then end up at an unexpected position in the file.

Parser.cpp already had special-case recovery when a stream's length
was stored in an indirect reference.

Commit ead02da98ac70c ("/JBIG2Globals") in #23503 added another case
where we could resolve indirect reference during parsing, but wasn't
aware of having to save and restore the reader position for that.

Put the save/restore code in `DocumentParser::parse_object_with_index`
instead, right before the place that ultimately changes the reader's
position during `Document::resolve`. This fixes `/JBIG2Globals` and
lets us remove the special-case code for `/Length` handling.

Since this is kind of subtle, include a test.
2024-03-19 19:20:01 -04:00
..
Fonts LibPDF+PDFViewer+MacPDF: Don't draw hidden text by default 2024-03-16 13:10:48 -04:00
CMakeLists.txt LibPDF: Implement most of the spec algorithm for picking TrueType glyphs 2024-02-25 15:15:20 +01:00
ColorSpace.cpp LibPDF: Use original error for failing ICC load 2024-02-21 13:37:08 +01:00
ColorSpace.h LibPDF: Make DeviceCMYKColorSpace::the() fallible 2024-02-01 13:42:04 -07:00
CommonNames.cpp LibPDF: Implement support for vertical text for Type0 2024-03-02 12:25:09 +01:00
CommonNames.h LibPDF+LibGfx: Pass jbig2-filtered data to JBIG2ImageDecoderPlugin 2024-03-09 16:01:22 +01:00
Document.cpp LibPDF: Return null for invalid refs, tolerate null objects as outline 2024-01-31 12:10:19 -05:00
Document.h LibPDF: Draw inline images 2023-12-20 12:45:16 -07:00
DocumentParser.cpp LibPDF: Handle indirect reference resolving during parsing more robustly 2024-03-19 19:20:01 -04:00
DocumentParser.h LibPDF: Scan for PDF file start in first 1024 bytes 2024-01-03 10:12:35 +01:00
Encoding.cpp LibPDF: Add a FIXME and a spec comment to Encoding::from_object() 2024-01-04 10:12:11 +01:00
Encoding.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Encryption.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Encryption.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Error.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Filter.cpp LibPDF: Plug in the CCITT3 1D decoder and pass corresponding options 2024-03-19 12:22:28 +01:00
Filter.h LibPDF+LibGfx: Support JBIG2s with /JBIG2Globals set 2024-03-09 16:01:22 +01:00
Forward.h Everywhere: Remove unused includes of AK/StdLibExtras.h 2023-01-02 20:27:20 -05:00
Function.cpp LibPDF: Reorder loops in SampledFunction::evaluate() 2024-02-13 19:45:19 +01:00
Function.h LibPDF: Add scaffolding for function objects 2023-11-06 10:01:05 +01:00
Interpolation.cpp LibPDF: Add first interpolation methods 2022-12-10 10:49:03 +01:00
Interpolation.h LibPDF: Add first interpolation methods 2022-12-10 10:49:03 +01:00
Object.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
ObjectDerivatives.cpp LibPDF: Always treat /Subtype /Image as binary data when dumping 2024-02-05 21:18:19 -05:00
ObjectDerivatives.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Operator.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Page.cpp LibPDF: Don't accidentally form new tokens on pages with contents arrays 2023-10-23 13:23:54 -04:00
Page.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Parser.cpp LibPDF: Handle indirect reference resolving during parsing more robustly 2024-03-19 19:20:01 -04:00
Parser.h LibPDF: Extract Parser::parse_inline_image() 2023-12-22 10:58:54 +01:00
Reader.cpp LibPDF: Add Reader::consume_non_eol_whitespace() 2024-01-04 10:14:30 +01:00
Reader.h LibPDF: Add Reader::consume_non_eol_whitespace() 2024-01-04 10:14:30 +01:00
Reference.h LibPDF: Make Reference store two u32s instead of one 2023-07-10 17:48:15 +01:00
Renderer.cpp LibGfx: Simplify path storage and tidy up APIs 2024-03-18 07:09:37 +01:00
Renderer.h LibPDF+PDFViewer+MacPDF: Don't draw hidden text by default 2024-03-16 13:10:48 -04:00
Value.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Value.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
XRefTable.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30