-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix JSON reader guards for scatter validity, validation, and max nesting depth #22452
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
Changes from all commits
e487058
2ba7c7d
9557471
861314b
71623d0
c8fa5a9
2a8e21d
758714a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -609,10 +609,13 @@ struct PdaSymbolToSymbolGroupId { | |
| // escape, comma, colon or whitespace characters. | ||
| auto constexpr newline = '\n'; | ||
| auto constexpr whitespace = ' '; | ||
| // Cast to unsigned char first so high-bit bytes (>= 0x80) are not sign-extended to negative | ||
| // int32_t values, which would underflow the min() clamp used as the lookup index. | ||
| auto const symbol_position = | ||
| symbol == delimiter | ||
| ? static_cast<int32_t>(newline) | ||
| : (symbol == newline ? static_cast<int32_t>(whitespace) : static_cast<int32_t>(symbol)); | ||
| : (symbol == newline ? static_cast<int32_t>(whitespace) | ||
| : static_cast<int32_t>(static_cast<unsigned char>(symbol))); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why a chain of casts? is this clamping to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a brief comment here explaining that we need this chain of casts? |
||
| PdaSymbolGroupIdT symbol_gid = | ||
| tos_sg_to_pda_sgid[min(symbol_position, pda_sgid_lookup_size - 1)]; | ||
| return stack_idx * static_cast<PdaSymbolGroupIdT>(symbol_group_id::NUM_PDA_INPUT_SGS) + | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.