1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:57:44 +00:00

LibPDF: Prevent crashes when loading XObject streams

These streams might need a Filter that isn't implemented yet, and thus
cannot be blindly MUST()-ed.
This commit is contained in:
Rodrigo Tobar 2023-02-12 14:50:41 +08:00 committed by Andreas Kling
parent 2a8e0da71c
commit 79b4293687

View file

@ -619,8 +619,8 @@ RENDERER_HANDLER(paint_xobject)
VERIFY(args.size() > 0);
auto resources = extra_resources.value_or(m_page.resources);
auto xobject_name = args[0].get<NonnullRefPtr<Object>>()->cast<NameObject>()->name();
auto xobjects_dict = MUST(resources->get_dict(m_document, CommonNames::XObject));
auto xobject = MUST(xobjects_dict->get_stream(m_document, xobject_name));
auto xobjects_dict = TRY(resources->get_dict(m_document, CommonNames::XObject));
auto xobject = TRY(xobjects_dict->get_stream(m_document, xobject_name));
Optional<NonnullRefPtr<DictObject>> xobject_resources {};
if (xobject->dict()->contains(CommonNames::Resources)) {