Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/parser: StructType.End() can overflow the File #48300

findleyr opened this issue Sep 9, 2021 · 0 comments

go/parser: StructType.End() can overflow the File #48300

findleyr opened this issue Sep 9, 2021 · 0 comments


Copy link

@findleyr findleyr commented Sep 9, 2021

As encountered in #48249, StructType.End() can overflow the file (such that File.Offset panics).

This is due to the error recovery here:;l=675;drc=0406d3a8e5301bd5fd697018e6e8fbb9c75eeb42

Which will set the StructType.Fields.Closing to the end of the file, and then StructType.Fields.End overflows:;l=252;drc=master

This is a low priority (the logic that gopls was using should have been more robust), but I feel like it should be an invariant of nodes that if Pos() or End() is not token.NoPos, they have a valid offset.

Are there counter-arguments or contradicting precedent?

CC @griesemer @stamblerre

@findleyr findleyr added the NeedsInvestigation label Sep 9, 2021
@findleyr findleyr added this to the Backlog milestone Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant