- Notifications
You must be signed in to change notification settings - Fork687
Fix: avoid 1B OOB read at EOF after class static block (Fixes #5254)#5261
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ript-project#5254)When a class static block ends at EOF (no trailing newline), the callerunconditionally consumed the next char after '}', causing a 1-byte OOB readin lexer_consume_next_character. Guard at the call site and raise the sameparse error the next stage expects.JerryScript-DCO-1.0-Signed-off-by: Harriet Zhu harrietzhu0115@gmail.com
| fields_size+=sizeof (scanner_location_t); | ||
| lexer_consume_next_character (context_p); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| else | ||
| { | ||
| lexer_consume_next_character (context_p); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
maybe we don't needelse asparser_raise_error will stop the execution.
| else | |
| { | |
| lexer_consume_next_character (context_p); | |
| } | |
| lexer_consume_next_character (context_p); |
seanshpark commentedOct 22, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
|
| lexer_consume_next_character (context_p); | ||
| if (JERRY_UNLIKELY(context_p->source_p >=context_p->source_end_p)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| if (JERRY_UNLIKELY(context_p->source_p >=context_p->source_end_p)) | |
| if (JERRY_UNLIKELY(context_p->source_p >=context_p->source_end_p)) |
When a class static block ends at EOF (no trailing newline), the caller unconditionally consumed the next char after '}', causing a 1-byte OOB read in lexer_consume_next_character. Guard at the call site and raise the same parse error the next stage expects.
JerryScript-DCO-1.0-Signed-off-by: Harriet Zhuharrietzhu0115@gmail.com
PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING