LibPDF: Keep track of the current object index/generation while Parsing

This information is required to decrypt encrypted strings/streams.
This commit is contained in:
Matthew Olsson 2022-03-21 11:26:31 -07:00 committed by Andreas Kling
commit a8de9cf541
Notes: sideshowbarker 2024-07-17 16:35:13 +09:00
2 changed files with 20 additions and 4 deletions

View file

@ -104,7 +104,7 @@ private:
PDFErrorOr<Value> parse_value();
PDFErrorOr<Value> parse_possible_indirect_value_or_ref();
PDFErrorOr<NonnullRefPtr<IndirectValue>> parse_indirect_value(int index, int generation);
PDFErrorOr<NonnullRefPtr<IndirectValue>> parse_indirect_value(u32 index, u32 generation);
PDFErrorOr<NonnullRefPtr<IndirectValue>> parse_indirect_value();
PDFErrorOr<Value> parse_number();
PDFErrorOr<NonnullRefPtr<NameObject>> parse_name();
@ -117,6 +117,9 @@ private:
PDFErrorOr<Vector<Command>> parse_graphics_commands();
void push_reference(Reference const& ref) { m_current_reference_stack.append(ref); }
void pop_reference() { m_current_reference_stack.take_last(); }
bool matches_eol() const;
bool matches_whitespace() const;
bool matches_number() const;
@ -142,6 +145,7 @@ private:
RefPtr<XRefTable> m_xref_table;
RefPtr<DictObject> m_trailer;
Optional<LinearizationDictionary> m_linearization_dictionary;
Vector<Reference> m_current_reference_stack;
};
};