Skip to content

Commit fa04132

Browse files
author
Tor Didriksen
committed
Bug#22782203 ACCESSING UNINITIALIZED MEMORY INSIDE STRINGS/DECIMAL.C ULL2DEC LINE ~1071
Bug#22839915 UNINTIALIZED VALUE IN DECIMAL_ROUND WITH DECIMAL CONVERSIONS Problem: misc valgrind warnings in the sanity() macro. Fix: remove reading of uninitialized buffer contents.
1 parent 8791a46 commit fa04132

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

mysql-test/r/type_newdecimal.result

+7
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,13 @@ Warnings:
21752175
Warning 1292 Truncated incorrect time value: '-t'
21762176
DROP TABLE t;
21772177
#
2178+
# Bug#22839915 UNINTIALIZED VALUE IN DECIMAL_ROUND
2179+
# WITH DECIMAL CONVERSIONS
2180+
#
2181+
select maketime(1,1.1,1);
2182+
maketime(1,1.1,1)
2183+
01:01:01
2184+
#
21782185
# Bug#21462523 RETURNED VALUE OVERFLOWS DECIMAL DATA TYPE
21792186
#
21802187
CREATE TABLE t1

mysql-test/t/type_newdecimal.test

+7
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,13 @@ INSERT INTO t VALUES(0);
17511751
SELECT 1 FROM t WHERE a<=>time('-t');
17521752
DROP TABLE t;
17531753

1754+
--echo #
1755+
--echo # Bug#22839915 UNINTIALIZED VALUE IN DECIMAL_ROUND
1756+
--echo # WITH DECIMAL CONVERSIONS
1757+
--echo #
1758+
1759+
select maketime(1,1.1,1);
1760+
17541761
--echo #
17551762
--echo # Bug#21462523 RETURNED VALUE OVERFLOWS DECIMAL DATA TYPE
17561763
--echo #

strings/decimal.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -136,8 +136,7 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
136136
999900000, 999990000, 999999000,
137137
999999900, 999999990 };
138138

139-
#define sanity(d) DBUG_ASSERT((d)->len >0 && ((d)->buf[0] | \
140-
(d)->buf[(d)->len-1] | 1))
139+
#define sanity(d) DBUG_ASSERT((d)->len >0)
141140

142141
#define FIX_INTG_FRAC_ERROR(len, intg1, frac1, error) \
143142
do \

0 commit comments

Comments
 (0)