summaryrefslogtreecommitdiff
path: root/strings/json_lib.c
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2023-04-03 13:34:51 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2023-05-15 12:17:30 +0530
commit3b34454c9dbc11c0090f323fe2b8ce21d12276a2 (patch)
tree1a1cb37839280477cb38c453e8f085e557b6295d /strings/json_lib.c
parent717e3b3cfdb167e8b930323397dc6e852ef94f17 (diff)
downloadmariadb-git-bb-10.9-MDEV-23187.tar.gz
MDEV-23187: Assorted assertion failures in json_find_path with certainbb-10.9-MDEV-2318710.9
collations Analysis: When we have negative index, the value in array_counter[] array is going to be -1 at some point ( because in case of negative index in json path, the initial value for a path with negative index is -<size_of_array>, and as we move forward in array while parsing it and finding path, this value increments). Since SKIPPED_STEP_MARK, is maximum uint value, it gets compared to some int value in the array and eventually equates to -1 and messes with path. Fix: Make SKIPPED_STEP_MARK maximum of INT32.
Diffstat (limited to 'strings/json_lib.c')
-rw-r--r--strings/json_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 903dec978b4..920fb1d4a89 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -1324,7 +1324,7 @@ int json_skip_key(json_engine_t *j)
}
-#define SKIPPED_STEP_MARK ((int) ~0)
+#define SKIPPED_STEP_MARK INT_MAX32
/*
Current step of the patch matches the JSON construction.