From 3b34454c9dbc11c0090f323fe2b8ce21d12276a2 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Mon, 3 Apr 2023 13:34:51 +0530 Subject: MDEV-23187: Assorted assertion failures in json_find_path with certain 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 -, 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. --- strings/json_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'strings/json_lib.c') 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. -- cgit v1.2.1