1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:07:36 +00:00

LibPDF: Don't use unsanitized values in error messages

Previously, constructing error messages with unsanitized input could
fail because error message strings must be UTF-8.
This commit is contained in:
Tim Ledbetter 2023-10-25 23:45:56 +01:00 committed by Andreas Kling
parent f8bf9c6506
commit b4296e1c9b
9 changed files with 41 additions and 15 deletions

View file

@ -73,3 +73,16 @@ TEST_CASE(encrypted_object_stream)
EXPECT_EQ(MUST(info_dict.author()).value(), "van der Knijff");
EXPECT_EQ(MUST(info_dict.creator()).value(), "Acrobat PDFMaker 9.1 voor Word");
}
TEST_CASE(malformed_pdf_document)
{
Array test_inputs = {
"oss-fuzz-testcase-62065.pdf"sv
};
for (auto test_input : test_inputs) {
auto file = MUST(Core::MappedFile::map(test_input));
auto document_or_error = PDF::Document::create(file->bytes());
EXPECT(document_or_error.is_error());
}
}