mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 17:54:16 +01:00
MDEV-28387 UBSAN: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strtoll10 on SELECT
Fixing the condition to raise an overflow in the ulonglong representation of the number is greater or equal to 0x8000000000000000ULL. Before this change the condition did not catch -9223372036854775808 (the smallest possible signed negative longlong number).
This commit is contained in:
parent
c4020b541c
commit
7c4c082349
3 changed files with 18 additions and 1 deletions
|
@ -5311,5 +5311,13 @@ NULL
|
|||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
#
|
||||
# MDEV-28387 UBSAN: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strtoll10 on SELECT
|
||||
#
|
||||
SET @a='-9223372036854775808';
|
||||
CREATE TABLE t (c1 INT,c2 CHAR);
|
||||
SELECT SUBSTR(0,@a) FROM t;
|
||||
SUBSTR(0,@a)
|
||||
DROP TABLE t;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
|
|
@ -2348,6 +2348,15 @@ DROP TABLE t1;
|
|||
DROP VIEW v1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-28387 UBSAN: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strtoll10 on SELECT
|
||||
--echo #
|
||||
|
||||
SET @a='-9223372036854775808'; # Quite specific value; considerably varying it will not work
|
||||
CREATE TABLE t (c1 INT,c2 CHAR);
|
||||
SELECT SUBSTR(0,@a) FROM t;
|
||||
DROP TABLE t;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
|
|
@ -241,7 +241,7 @@ end4:
|
|||
*endptr= (char*) s;
|
||||
if (negative)
|
||||
{
|
||||
if (li > MAX_NEGATIVE_NUMBER)
|
||||
if (li >= MAX_NEGATIVE_NUMBER)
|
||||
goto overflow;
|
||||
return -((longlong) li);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue