MDEV-22553: Assertion `info->lastpos == (~ (my_off_t) 0)' failed in mi_rkey

In mi_check_index_tuple(), when rowid filter check returns
CHECK_OUT_OF_RANGE, set info->lastpos= HA_OFFSET_ERROR, like
it is done above for the ICP check.
This commit is contained in:
Sergei Petrunia 2020-07-08 23:25:08 +03:00
parent 0d6d801e58
commit 41221091f6
3 changed files with 1655 additions and 1 deletions

View file

@ -0,0 +1,21 @@
#
# MDEV-22553: Assertion `info->lastpos == (~ (my_off_t) 0)' failed in mi_rkey with rowid_filer=on
#
CREATE TABLE t1 (
a smallint(6) DEFAULT NULL,
b bigint(20) DEFAULT NULL,
c varchar(64) DEFAULT NULL,
d varchar(64) DEFAULT NULL,
e smallint(6) DEFAULT NULL,
f bigint(20) DEFAULT NULL,
KEY a (a),
KEY d (d),
KEY f (f)
) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
# Insert a lot of rows
ALTER TABLE t1 ENABLE KEYS;
# Must not crash:
SELECT * FROM t1 WHERE ( a BETWEEN 255 AND 270 OR f = 200 ) AND f IN ( 1, 4, 112, 143 ) AND d IN ('Montana', 'South Dakota');
a b c d e f
DROP TABLE t1;

File diff suppressed because it is too large Load diff

View file

@ -561,7 +561,15 @@ check_result_t mi_check_index_tuple(MI_INFO *info, uint keynr, uchar *record)
if (need_unpack && mi_unpack_index_tuple(info, keynr, record))
res= CHECK_ERROR;
else
res= info->rowid_filter_func(info->rowid_filter_func_arg);
{
if ((res= info->rowid_filter_func(info->rowid_filter_func_arg)) ==
CHECK_OUT_OF_RANGE)
{
/* We got beyond the end of scanned range */
info->lastpos= HA_OFFSET_ERROR; /* No active record */
my_errno= HA_ERR_END_OF_FILE;
}
}
}
return res;
}