MDEV-35548: Fix out-of-bounds array access in json_get_path_start#5013
Open
grooverdan wants to merge 1 commit intoMariaDB:10.6from
Open
MDEV-35548: Fix out-of-bounds array access in json_get_path_start#5013grooverdan wants to merge 1 commit intoMariaDB:10.6from
grooverdan wants to merge 1 commit intoMariaDB:10.6from
Conversation
json_get_path_start() set p->last_step to p->steps - 1, creating a pointer before the beginning of the steps[] array. This is undefined behavior flagged by UBSAN as "index -1 out of bounds for type json_path_step_t[32]". Use NULL as the sentinel value instead, and check for NULL in json_get_path_next() rather than comparing against p->steps. Backport to 10.6 of commit 4f54689. Additional test case from Rucha Deodhar Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com> Signed-off-by: Varun Deep Saini <deepsainivarun@gmail.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.
json_get_path_start() set p->last_step to p->steps - 1, creating a pointer before the beginning of the steps[] array. This is undefined behavior flagged by UBSAN as "index -1 out of bounds for type json_path_step_t[32]".
Use NULL as the sentinel value instead, and check for NULL in json_get_path_next() rather than comparing against p->steps.
Backport to 10.6 of commit 4f54689.
Additional test case from Rucha Deodhar