1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt

Regexp_processor_pcre::fix_owner() called Regexp_processor_pcre::compile(),
which could fail on the regex syntax error in the pattern and put
an error into the diagnostics area. However, the callers:
  - Item_func_regex::fix_length_and_dec()
  - Item_func_regexp_instr::fix_length_and_dec()
still returned "false" in such cases, which made the code
crash later inside Diagnostics_area::set_ok_status().

Fix:

- Change the return type of fix_onwer() from "void" to "bool"
  and return "true" whenever an error is put to the DA
  (e.g. on the syntax error in the pattern).
- Fixing fix_length_and_dec() of the mentioned Item_func_xxx
  classes to return "true" if fix_onwer() returned "true".
This commit is contained in:
Alexander Barkov
2024-04-24 16:54:00 +04:00
parent 267dd5a993
commit dc25d600ee
6 changed files with 118 additions and 9 deletions

View File

@ -192,4 +192,20 @@ SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a;
SUM(a.t)
0
DROP TABLE t0;
#
# MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt
#
CREATE TABLE t1 (c0 INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT ('' RLIKE '[') AS c1 FROM t1;
ERROR 42000: Regex error 'missing terminating ] for character class at offset 1'
SELECT REGEXP_INSTR('','[') AS c1 FROM t1;
ERROR 42000: Regex error 'missing terminating ] for character class at offset 1'
SELECT c0, '' RLIKE NULL AS c1, REGEXP_INSTR('', NULL) AS c2
FROM t1 ORDER BY c0;
c0 c1 c2
1 NULL NULL
2 NULL NULL
3 NULL NULL
DROP TABLE t1;
# End of 10.5 tests