Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve lexing and parsing of invalid annotations (again) #2166

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

keithw
Copy link
Member

@keithw keithw commented Mar 10, 2023

This adds a bounds-check to WastLexer::GetText to handle the case when the offset is earlier than token_start (e.g. because GetStringToken found a newline in the string and reset token_start to point to it).

Also revises GetIdToken -> GetIdChars to stop skipping the initial char in an annotation delimiter, which is an idchar+ but not an id token.

Also fixes the WastParser to handle EOF when reading for the end of an annotation, both for code metadata annotation and other kinds. Previously this produced an infinite loop (but only when --enable-annotations was provided).

Fixes #2165 and adds some more regression tests.

This is sort of deja vu after #2150, sigh.

This adds a bounds-check to WastLexer::GetText to handle the case when
the offset is earlier than token_start (e.g. because GetStringToken
found a newline in the string and reset token_start to point at it).

Also revises GetIdToken -> GetIdChars to stop skipping the initial char
in an annotation delimiter, which is an idchar+ but not an id token.

Also fixes the WastParser to handle EOF when reading for the end of an
annotation, both for code metadata annotations and other kinds.
Previously this produced an infinite loop (but only with
--enable-annotations).

Fixes #2165
@keithw keithw merged commit a725c63 into main Mar 10, 2023
@keithw keithw deleted the annotation-fix branch March 10, 2023 21:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'@' before a quote (") causes a libc++abi.dylib crash using wat2wasm.
2 participants