mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#31227: memory overrun with decimal (6,6) and zerofill and group_concat
Reserve the space for the leading 0 (before the decimal point) in DECIMAL(a,a) ZEROFILL. mysql-test/r/type_decimal.result: show that we allocate a large enough buffer for output of DECIMAL(a,a) [ZEROFILL]. mysql-test/t/type_decimal.test: show that we allocate a large enough buffer for output of DECIMAL(a,a) [ZEROFILL]. without patch for bug#31227, valgrind will complain here; so will a debug build. sql/my_decimal.cc: Reserve the space for the leading 0 (before the decimal point) in DECIMAL(a,a) ZEROFILL. Doxygenise preamble of my_decimal2string().
This commit is contained in:
@ -683,6 +683,7 @@ select * from t1;
|
||||
a b
|
||||
123.12345 123.1
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1
|
||||
(EMPNUM CHAR(3) NOT NULL,
|
||||
HOURS DECIMAL(5));
|
||||
@ -799,3 +800,10 @@ SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1;
|
||||
ROUND(qty,3) dps ROUND(qty,dps)
|
||||
1.133 3 1.133
|
||||
DROP TABLE t1;
|
||||
create table t1 (f1 decimal(6,6),f2 decimal(6,6) zerofill);
|
||||
insert into t1 values (-0.123456,0.123456);
|
||||
select group_concat(f1),group_concat(f2) from t1;
|
||||
group_concat(f1) group_concat(f2)
|
||||
-0.123456 0.123456
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@ -278,7 +278,7 @@ update t1 set b=a;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Test for BUG#8397: decimal type in subselects (Item_cache_decimal)
|
||||
@ -408,3 +408,14 @@ INSERT INTO t1 VALUES (1.1325,3);
|
||||
SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #31227: memory overrun with decimal (6,6) and zerofill and group_concat
|
||||
# valgrind will complain about this (the group_concat(f2)) on unpatched mysqld.
|
||||
#
|
||||
create table t1 (f1 decimal(6,6),f2 decimal(6,6) zerofill);
|
||||
insert into t1 values (-0.123456,0.123456);
|
||||
select group_concat(f1),group_concat(f2) from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user