ladybird/Tests/LibPDF/CMakeLists.txt
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

27 lines
570 B
CMake

set(TEST_SOURCES
BenchmarkPDF.cpp
TestPDF.cpp
)
foreach(source IN LISTS TEST_SOURCES)
serenity_test("${source}" LibPDF LIBS LibCore LibGfx LibPDF)
endforeach()
set(TEST_FILES
colorspaces.pdf
complex.pdf
encoding.pdf
encryption_nocopy.pdf
jbig2-globals.pdf
linearized.pdf
non-linearized.pdf
oss-fuzz-testcase-62065.pdf
password-is-sup.pdf
pattern.pdf
text.pdf
type1.pdf
type3.pdf
)
install(FILES ${TEST_FILES} DESTINATION home/anon/Documents/pdf)
install(FILES ${TEST_FILES} DESTINATION usr/Tests/LibPDF)