fix: leftover inject value stoi abort - #2
Open
tonycoder-hub wants to merge 1 commit into
Open
Conversation
CheckValue length-caps at 11 then digit-checks and calls stoi; values like 2147483648 still throw and can abort event_inject. A from_chars lambda was already present but unused (and missing a semicolon). Parse with from_chars like tools/inject_event and reject overflow/junk. Signed-off-by: Tony Coder <407243179@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InjectionEventDispatch::CheckValue(tools/event_inject) length-caps at 11 then digit-checks and callsstd::stoi. Values like2147483648/-2147483649still throwstd::out_of_rangeand can abort event_inject.A
from_charslambda was already present but unused (and missing a semicolon, so the translation unit does not compile as written). Finish the migration: parse withParseInjectValue(std::from_chars) like the siblingtools/inject_eventInputSendeventCommand::CheckValue, and reject overflow/junk without throwing.Host test
Covers INT32 min/max, empty/junk,
2147483648,-2147483649, 11×9. asan/ubsan clean. Also shows barestoistill throws on those overflow strings.Test plan
0/-1/2147483647still acceptedSigned-off-by: Tony Coder 407243179@qq.com