summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2003-11-24 15:49:35 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2003-11-24 15:49:35 +0200
commit69ea14158bc953ceef3d21d0020751d745980e1a (patch)
tree3874992ccb1ffe885afc5cd512c4822b4b5ae261
parent5281f34e6471af78526860442a2e38a07845e27f (diff)
parentdcf29d5ec82cdc5320d42c86d2fb61c4c13cb848 (diff)
downloadmariadb-git-69ea14158bc953ceef3d21d0020751d745980e1a.tar.gz
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/work/mysql-4.0
-rw-r--r--mysql-test/r/type_decimal.result6
-rw-r--r--mysql-test/t/type_decimal.test6
-rw-r--r--sql/field.cc4
3 files changed, 14 insertions, 2 deletions
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index b74765696a2..df5402c89a8 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -363,3 +363,9 @@ CREATE TABLE t1 (a_dec DECIMAL(-2,1));
Too big column length for column 'a_dec' (max = 255). Use BLOB instead
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
Too big column length for column 'a_dec' (max = 255). Use BLOB instead
+create table t1(a decimal(10,4));
+insert into t1 values ("+0000100000000");
+select * from t1;
+a
+9999999.9999
+drop table t1;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 7aedc051905..14d9625710b 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -240,3 +240,9 @@ CREATE TABLE t1 (a_dec DECIMAL(-1,0));
CREATE TABLE t1 (a_dec DECIMAL(-2,1));
--error 1074
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
+
+# Zero prepend overflow bug
+create table t1(a decimal(10,4));
+insert into t1 values ("+0000100000000");
+select * from t1;
+drop table t1;
diff --git a/sql/field.cc b/sql/field.cc
index 43481ca0963..58781624239 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -632,7 +632,7 @@ void Field_decimal::store(const char *from,uint len)
if (zerofill)
{
left_wall=to-1;
- while (pos != left_wall) // Fill with zeros
+ while (pos > left_wall) // Fill with zeros
*pos--='0';
}
else
@@ -640,7 +640,7 @@ void Field_decimal::store(const char *from,uint len)
left_wall=to+(sign_char != 0)-1;
if (!expo_sign_char) // If exponent was specified, ignore prezeros
{
- for (;pos != left_wall && pre_zeros_from !=pre_zeros_end;
+ for (;pos > left_wall && pre_zeros_from !=pre_zeros_end;
pre_zeros_from++)
*pos--= '0';
}