Skip to content

MDEV-40143: st_isvalid() does not clear NULL state between rows#5313

Open
DaveGosselin-MariaDB wants to merge 1 commit into
12.3from
12.3-mdev-40143-inconsistent-stisvalid
Open

MDEV-40143: st_isvalid() does not clear NULL state between rows#5313
DaveGosselin-MariaDB wants to merge 1 commit into
12.3from
12.3-mdev-40143-inconsistent-stisvalid

Conversation

@DaveGosselin-MariaDB

Copy link
Copy Markdown
Member

The st_isvalid() function evaluates nullability on every row. Previously, it would preserve potentially stale null state between rows, so the first row yielding a null result for st_isvalid() would propagate to the results for the remaining rows.

Implementation-wise, this patch changes the Item_func_isvalid::val_int method implementation to work like Item_func_validate::val_str in that it assumes that the method will indicate a null result for the row unless it returns a non-null result, at which point it clears the null_value flag.

The st_isvalid() function evaluates nullability on every row.  Previously,
it would preserve potentially stale null state between rows, so the first
row yielding a null result for st_isvalid() would propagate to the results
for the remaining rows.

Implementation-wise, this patch changes the Item_func_isvalid::val_int
method implementation to work like Item_func_validate::val_str in that it
assumes that the method will indicate a null result for the row unless
it returns a non-null result, at which point it clears the null_value flag.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request fixes the handling of the null_value flag in Item_func_isvalid::val_int() by initializing it to 1 and only resetting it to 0 upon a successful validity check. It also adds corresponding test cases to verify this behavior. The review feedback correctly identifies a potential null pointer dereference if args[0]->val_str() returns NULL, suggesting a defensive check to prevent a server crash.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread sql/item_geofunc.cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant