From 801cfd5ae3ee4be2b6d5832abae28e7a94eb3860 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 20 Oct 2023 22:39:36 -0400 Subject: [PATCH] LibPDF: Let parser process filters by default This fixes a small bug from 39b2eed3f6e: That commit tried to disable filters for the very first object read, for the case covered in Tests/LibPDF/password-is-sup.pdf. However, it accidentally also disabled filters by default. Most of the time, this isn't really a difference: We call `set_filters_enabled(true);` very early in `DocumentParser::initialize_linearization_dict()`, which explicitly enables filters, and `initialize_linearization_dict()` is the very first thing called in `DocumentParser::initialize()`. But there's an early exit in `initialize_linearization_dict()` for if there's nothing looking like an indirect object right after the header, and in this case we used to not enable filtering, and would hand compressed streams to the operand parser. (And due to a 2nd bug, we'd even do this if the header line was followed by an empty line.) --- Userland/Libraries/LibPDF/Parser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibPDF/Parser.h b/Userland/Libraries/LibPDF/Parser.h index 99ec82d8ec..e616991783 100644 --- a/Userland/Libraries/LibPDF/Parser.h +++ b/Userland/Libraries/LibPDF/Parser.h @@ -83,7 +83,7 @@ protected: WeakPtr m_document; Vector m_current_reference_stack; bool m_enable_encryption { true }; - bool m_enable_filters { false }; + bool m_enable_filters { true }; }; };