Skip to content
/ server Public

MDEV-38264: Fix failed assertion in json_find_path with trailing commas#4733

Open
abhishek593 wants to merge 1 commit intoMariaDB:10.11from
abhishek593:MDEV-38264
Open

MDEV-38264: Fix failed assertion in json_find_path with trailing commas#4733
abhishek593 wants to merge 1 commit intoMariaDB:10.11from
abhishek593:MDEV-38264

Conversation

@abhishek593
Copy link

The function json_skip_array_and_count() was trapping syntax errors (e.g., trailing commas) in a local engine copy. Because the error state wasn't propagated back to the main engine, json_find_path() would proceed with an inconsistent state, eventually triggering an assertion failure. This patch ensures that any error encountered during the lookahead scan is propagated to the primary engine. This allows the parser to fail gracefully with a syntax error instead of crashing.

Changes:

  • Added error propagation back to the primary engine in json_skip_array_and_count()
  • Added tests to verify the behaviour is working as intended

@grooverdan grooverdan added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 5, 2026
SELECT JSON_VALUE('{"a":[1,2]}', '$.a[*]');

--echo # End of 10.11 Test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note test should be above the line above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

The function json_skip_array_and_count() was trapping syntax errors
(e.g., trailing commas) in a local engine copy. Because the error state
wasn't propagated back to the main engine, json_find_path() would
proceed with an inconsistent state, eventually triggering an assertion
failure.

This patch ensures that any error encountered during the lookahead
scan is propagated to the primary engine. This allows the parser to
fail gracefully with a syntax error instead of crashing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

3 participants