Skip to content

Conversation

@ricflams
Copy link
Contributor

  • Detect and prevent an xref table/stream at a certain offset from being read twice; malformed xref tables with circular references could otherwise cause the table-reading to loop forever.
  • Another approach could be to prevent TryReadTableAtOffset from changing the bytes' CurrentOffset to the lastObjPosition in its attempt to read a table (eg restore CurrentOffset after the attempt to read a Table) so the outer bytes-loop could continue its search through the entire bytes unaffected.

- Detect and prevent an xref table/stream at a certain offset from being read twice; malformed xref tables with circular references could otherwise cause the table-reading to loop forever.
- Another approach could be to prevent TryReadTableAtOffset from changing the bytes' CurrentOffset to the lastObjPosition in its attempt to read a table (eg restore CurrentOffset after the attempt to read a Table) so the outer bytes-loop could continue its search through the entire bytes unaffected.
@BobLd
Copy link
Collaborator

BobLd commented Oct 1, 2025

@ricflams I'm merging as-is, but feel free to later create a PR if you want to implement the other approach (if there's reasons for that, i.e. performance maybe)

@BobLd BobLd merged commit c28d114 into UglyToad:master Oct 1, 2025
2 checks passed
@ricflams
Copy link
Contributor Author

ricflams commented Oct 1, 2025

@BobLd thanks, and I think this is just fine and probably the easiest approach to reason about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants