Don't use list as default in PdfParser read_prev_trailer (#9629)
This commit is contained in:
commit
e7556b19b7
@ -692,7 +692,7 @@ class PdfParser:
|
|||||||
self.read_prev_trailer(self.trailer_dict[b"Prev"])
|
self.read_prev_trailer(self.trailer_dict[b"Prev"])
|
||||||
|
|
||||||
def read_prev_trailer(
|
def read_prev_trailer(
|
||||||
self, xref_section_offset: int, processed_offsets: list[int] = []
|
self, xref_section_offset: int, processed_offsets: list[int] | None = None
|
||||||
) -> None:
|
) -> None:
|
||||||
assert self.buf is not None
|
assert self.buf is not None
|
||||||
trailer_offset = self.read_xref_table(xref_section_offset=xref_section_offset)
|
trailer_offset = self.read_xref_table(xref_section_offset=xref_section_offset)
|
||||||
@ -708,6 +708,8 @@ class PdfParser:
|
|||||||
)
|
)
|
||||||
trailer_dict = self.interpret_trailer(trailer_data)
|
trailer_dict = self.interpret_trailer(trailer_data)
|
||||||
if b"Prev" in trailer_dict:
|
if b"Prev" in trailer_dict:
|
||||||
|
if processed_offsets is None:
|
||||||
|
processed_offsets = []
|
||||||
processed_offsets.append(xref_section_offset)
|
processed_offsets.append(xref_section_offset)
|
||||||
check_format_condition(
|
check_format_condition(
|
||||||
trailer_dict[b"Prev"] not in processed_offsets, "trailer loop found"
|
trailer_dict[b"Prev"] not in processed_offsets, "trailer loop found"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user