Skip to content

MDEV-32331: json path crashes without a character set - #5433

Merged
grooverdan merged 1 commit into
MariaDB:10.11from
grooverdan:MDEV-32331
Jul 31, 2026
Merged

MDEV-32331: json path crashes without a character set#5433
grooverdan merged 1 commit into
MariaDB:10.11from
grooverdan:MDEV-32331

Conversation

@grooverdan

Copy link
Copy Markdown
Member

Across a range of JSON functions taking a path argument there are SQL expressions that dont' have a character set. If these expressions don't have a character set fall back to the character set of the argument of the json function that represent the document being operated on. If this doesn't have a character set fall back to my_charset_utf8mb4_bin.

This covers the 11.4 JSON_KEY_VALUE function also as it reuses the Json_path_extractor::extract method.

Add nonnull and warn_unused_result to the json path functions to facilitate compiler and UBSAN catching of the problem early.

As null values of s_p are incompatible with report_path_error, jump directly to a null return which is consistent with the defination of the JSON sql funciton.

@grooverdan grooverdan added the MariaDB Foundation Pull requests created by MariaDB Foundation label Jul 22, 2026
@grooverdan
grooverdan force-pushed the MDEV-32331 branch 2 times, most recently from 092f549 to 6a6ae40 Compare July 22, 2026 05:37
@MariaDB MariaDB deleted a comment from gemini-code-assist Bot Jul 22, 2026
Across a range of JSON functions taking a path argument
there are SQL expressions that dont' have a character
set. If these expressions don't have a character set
fall back to the character set of the argument of the
json function that represent the document being operated
on. If this doesn't have a character set fall back to
my_charset_utf8mb4_bin.

This covers the 11.4 JSON_KEY_VALUE function also as it
reuses the Json_path_extractor::extract method.

Add nonnull and warn_unused_result to the json path
functions to facilitate compiler and UBSAN catching of the
problem early.

As null values of s_p are incompatible with report_path_error,
jump directly to a null return which is consistent with
the defination of the JSON sql funciton.
@grooverdan
grooverdan enabled auto-merge (rebase) July 31, 2026 22:46
@grooverdan
grooverdan merged commit 1dab253 into MariaDB:10.11 Jul 31, 2026
15 of 17 checks passed
@grooverdan
grooverdan deleted the MDEV-32331 branch August 1, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MariaDB Foundation Pull requests created by MariaDB Foundation

Development

Successfully merging this pull request may close these issues.

2 participants