1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +00:00

LibPDF: Don't crash on encrypted files with streams with filter arrays

Makes it possible to render more than 0 pages of CIPA_DC-003-2020_E.pdf
This commit is contained in:
Nico Weber 2023-07-23 22:46:25 -04:00 committed by Tim Flynn
parent 532230c0e4
commit af5a7b9a51

View file

@ -676,8 +676,10 @@ void StandardSecurityHandler::crypt(NonnullRefPtr<Object> object, Reference refe
}; };
if (stream->dict()->contains(CommonNames::Filter)) { if (stream->dict()->contains(CommonNames::Filter)) {
auto filter = stream->dict()->get_name(m_document, CommonNames::Filter).release_value_but_fixme_should_propagate_errors()->name(); // ISO 32000 (PDF 2.0), 7.4.10 Crypt filter
if (filter == "Crypt") // "The Crypt filter shall be the first filter in the Filter array entry."
auto filters = m_document->read_filters(stream->dict()).release_value_but_fixme_should_propagate_errors();
if (!filters.is_empty() && filters[0] == "Crypt")
TODO(); TODO();
} }
} else if (object->is<StringObject>()) { } else if (object->is<StringObject>()) {