diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-18 16:31:54 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-18 16:31:54 +0200 |
commit | b69191bbb2278fce92b470e8e3abafe048166e39 (patch) | |
tree | 47845653b82fce2bf6682dc4c8a967d97a64935f /sql/sql_analyze_stmt.cc | |
parent | cac995ec6f7d23c5b725e6ee19fc4f6ed38561f1 (diff) | |
download | mariadb-git-b69191bbb2278fce92b470e8e3abafe048166e39.tar.gz |
MDEV-26645: Fix UB in Item_func_plus and Item_func_minus
An integer overflow in an expression like a+b or a-b is undefined behavior.
The compiler is allowed to assume that no such overflow is possible,
and optimize away some code accordingly.
Item_func_plus::int_op(), Item_func_minus::int_op(): Always check
for overflow.
Depending on the compiler and the compilation options, a test might fail:
CURRENT_TEST: main.func_math
mysqltest: At line 425: query 'SELECT 9223372036854775807 + 9223372036854775807' succeeded - should have failed with errno 1690...
A similar bug had been fixed earlier in
commit 328edf8560dbf1941ce314fa112e0db05d9f97f1.
Diffstat (limited to 'sql/sql_analyze_stmt.cc')
0 files changed, 0 insertions, 0 deletions