mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#57818 string conversion function died
Bug#57913 large negative number to string conversion functions crash String object which is used as result container of the item has uninitialized 'str_charset' field. This object might be used later to preform some internal operations and str_charset field is involved in these operations. It leads to crash. The fix is to intialize str_charset in my_decimal2string() func.
This commit is contained in:
@ -2600,4 +2600,16 @@ ORDER BY QUOTE(t1.a);
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Bug#57913 large negative number to string conversion functions crash
|
||||||
|
# Bug#57810 case/when/then : Assertion failed: length || !scale
|
||||||
|
#
|
||||||
|
SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1));
|
||||||
|
'1' IN ('1', SUBSTRING(-9223372036854775809, 1))
|
||||||
|
1
|
||||||
|
SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3));
|
||||||
|
CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3))
|
||||||
|
1
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect DECIMAL value: ''
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
@ -1362,4 +1362,11 @@ SELECT 1 FROM t1, t1 t2
|
|||||||
ORDER BY QUOTE(t1.a);
|
ORDER BY QUOTE(t1.a);
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#57913 large negative number to string conversion functions crash
|
||||||
|
--echo # Bug#57810 case/when/then : Assertion failed: length || !scale
|
||||||
|
--echo #
|
||||||
|
SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1));
|
||||||
|
SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3));
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
@ -109,6 +109,7 @@ int my_decimal2string(uint mask, const my_decimal *d,
|
|||||||
result= decimal2string((decimal_t*) d, (char*) str->ptr(),
|
result= decimal2string((decimal_t*) d, (char*) str->ptr(),
|
||||||
&length, (int)fixed_prec, fixed_dec,
|
&length, (int)fixed_prec, fixed_dec,
|
||||||
filler);
|
filler);
|
||||||
|
str->set_charset(&my_charset_bin);
|
||||||
str->length(length);
|
str->length(length);
|
||||||
return check_result(mask, result);
|
return check_result(mask, result);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user