Skip to content

Fix infinite loop with bad section ends in TastyHeaderUnpickler#25676

Open
SolalPirelli wants to merge 14 commits intoscala:mainfrom
dotty-staging:s/m9
Open

Fix infinite loop with bad section ends in TastyHeaderUnpickler#25676
SolalPirelli wants to merge 14 commits intoscala:mainfrom
dotty-staging:s/m9

Conversation

@SolalPirelli
Copy link
Copy Markdown
Contributor

@SolalPirelli SolalPirelli commented Apr 1, 2026

Don't go backward with end of sections.

This required adding some checks for:

  • don't write Nat or LongNat if the arg is <0
  • don't read Nat or LongNat if the result would be <0
  • don't read Int or LongInt if the result overflowed

And fixing the resulting problems.

How much have you relied on LLM-based tools in this contribution?

not

How was the solution tested?

new test

@SolalPirelli SolalPirelli requested a review from mbovel April 1, 2026 13:33
mbovel
mbovel previously approved these changes Apr 1, 2026
else if (tag >= firstNatASTTreeTag) { readNat(); skipTree() }
else if (tag >= firstASTTreeTag) skipTree()
else if (tag >= firstNatTreeTag) readNat()
else if (tag >= firstNatTreeTag) readLongInt()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two calls used to be equivalent because we didn't check that it was really a nat or really not a long

Copy link
Copy Markdown
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Details only.

@SolalPirelli SolalPirelli requested a review from sjrd April 8, 2026 07:16
else if (tag >= firstNatASTTreeTag) { readNat(); scanTree(buf) }
else if (tag >= firstASTTreeTag) scanTree(buf)
else if (tag >= firstNatTreeTag) readNat()
else if (tag >= firstNatTreeTag) readLongInt()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

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.

3 participants