mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:07:45 +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:
parent
f8bf9c6506
commit
b4296e1c9b
9 changed files with 41 additions and 15 deletions
|
@ -11,6 +11,7 @@ set(TEST_FILES
|
|||
encryption_nocopy.pdf
|
||||
linearized.pdf
|
||||
non-linearized.pdf
|
||||
oss-fuzz-testcase-62065.pdf
|
||||
password-is-sup.pdf
|
||||
type1.pdf
|
||||
)
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
1
Tests/LibPDF/oss-fuzz-testcase-62065.pdf
Normal file
1
Tests/LibPDF/oss-fuzz-testcase-62065.pdf
Normal file
|
@ -0,0 +1 @@
|
|||
%PDF-<2D><><EFBFBD>
|
Loading…
Add table
Add a link
Reference in a new issue