mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Bug #51357: crash when using handler commands on spatial indexes
Spatial indexes were not checking for out-of-record condition in the handler next command when the previous command didn't found rows. Fixed by making the rtree index to check for end of rows condition before re-using the key from the previous search. Fixed another crash if the tree has changed since the last search. Added a test case for the other error.
This commit is contained in:
@@ -404,10 +404,16 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length)
|
||||
|
||||
int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
||||
{
|
||||
my_off_t root;
|
||||
my_off_t root= info->s->state.key_root[keynr];
|
||||
MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
|
||||
|
||||
if (!info->buff_used)
|
||||
if (root == HA_OFFSET_ERROR)
|
||||
{
|
||||
my_errno= HA_ERR_END_OF_FILE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!info->buff_used && !info->page_changed)
|
||||
{
|
||||
uint k_len = keyinfo->keylength - info->s->base.rec_reflength;
|
||||
/* rt_PAGE_NEXT_KEY(info->int_keypos) */
|
||||
@@ -428,16 +434,8 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
|
||||
{
|
||||
my_errno= HA_ERR_END_OF_FILE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return rtree_get_req(info, keyinfo, key_length, root, 0);
|
||||
}
|
||||
|
||||
return rtree_get_req(info, keyinfo, key_length, root, 0);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user