diff options
author | Magne Mahre <magne.mahre@oracle.com> | 2010-11-18 14:02:24 +0100 |
---|---|---|
committer | Magne Mahre <magne.mahre@oracle.com> | 2010-11-18 14:02:24 +0100 |
commit | 64c059b0a8faee653378174ba9c2fa685194c0d7 (patch) | |
tree | 19cc50225bc9734b4dce0d9e8bf12dd9301a0f60 /mysql-test/t/func_misc.test | |
parent | afcf7bc71c0d0d2777789d2314d06858e7cf570a (diff) | |
download | mariadb-git-64c059b0a8faee653378174ba9c2fa685194c0d7.tar.gz |
Bug#58199 name_const in the having clause crashes
NAME_CONST(..) was used wrongly in a HAVING clause, and
should have caused a user error. Instead, it caused a
segmentation fault.
During parsing, the value parameter to NAME_CONST was
specified to be an uninitialized Item_ref object (it
would be resolved later). During the semantic analysis,
the object is tested, and since it was not initialied,
the server seg.faulted.
The fix is to check if the object is initialized
before testing it. The same pattern has already been
applied to most other methods in the Item_ref class.
Bug was introduced by the optimization done as part of
Bug#33546.
Diffstat (limited to 'mysql-test/t/func_misc.test')
-rw-r--r-- | mysql-test/t/func_misc.test | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index ec71e950ca7..8cea850b184 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -504,4 +504,15 @@ SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; DROP TABLE t1; ---echo End of 5.1 tests +--echo # +--echo # Bug #58199: name_const in the having clause crashes +--echo # + +CREATE TABLE t1 (a INT); + +# NAME_CONST() would seg.fault when used wrongly in a HAVING clause +--error ER_WRONG_ARGUMENTS +SELECT 1 from t1 HAVING NAME_CONST('', a); + +DROP TABLE t1; + |