Skip to content

Fix possible infinite loop in reader.collectPages - #375

Open
tgulacsi wants to merge 15 commits into
carlos7ags:mainfrom
UNO-SOFT:infinite-loop
Open

Fix possible infinite loop in reader.collectPages#375
tgulacsi wants to merge 15 commits into
carlos7ags:mainfrom
UNO-SOFT:infinite-loop

Conversation

@tgulacsi

Copy link
Copy Markdown

Description

Handle cycles in pagetree walk.

Problem

I've met with infinite loops in signing and page number retrieval - sorry, I don't have examples yet.

Checklist

  • Code is formatted (gofmt -s -w .)
  • Tests pass (make test)
  • No references to external PDF libraries (clean room)

@tgulacsi
tgulacsi requested a review from carlos7ags as a code owner June 29, 2026 19:32
@tgulacsi

tgulacsi commented Jul 1, 2026

Copy link
Copy Markdown
Author

Test with

go test -run=Corrupt -v -timeout=30s

It should not timeout (but will on main).

carlos7ags
carlos7ags previously approved these changes Jul 2, 2026
This allows tokenizer to advance and avoid infinite loops.

But I don't know whether this is the good solution,
or should Tokenzier.Next() return an error in such cases?
@tgulacsi

tgulacsi commented Jul 2, 2026

Copy link
Copy Markdown
Author

Tokenizer now advances all time, but this may be not the best solution.

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