diff options
author | unknown <msvensson@shellback.(none)> | 2006-03-01 15:49:50 +0100 |
---|---|---|
committer | unknown <msvensson@shellback.(none)> | 2006-03-01 15:49:50 +0100 |
commit | c3ca791de3f1756a75200cc97a604ac2586aa1e9 (patch) | |
tree | b666e83927f175d602a90711bf3456d1ca0d05be /strings/decimal.c | |
parent | 7407e6ee6c85af33f8937860039dfa527df6fad4 (diff) | |
parent | 65225c3ea9b636fff26274ff37a98676b27994fe (diff) | |
download | mariadb-git-c3ca791de3f1756a75200cc97a604ac2586aa1e9.tar.gz |
Merge shellback.(none):/home/msvensson/mysql/mysql-5.0
into shellback.(none):/home/msvensson/mysql/mysql-5.1
sql/sql_db.cc:
Auto merged
strings/decimal.c:
Auto merged
tests/mysql_client_test.c:
Auto merged
Diffstat (limited to 'strings/decimal.c')
-rw-r--r-- | strings/decimal.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index 919d4c7d3bc..c3ab9f51a99 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1353,6 +1353,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale) } from+=i; *buf=x ^ mask; + if (((uint32)*buf) >= powers10[intg0x+1]) + goto err; if (buf > to->buf || *buf != 0) buf++; else @@ -1362,6 +1364,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale) { DBUG_ASSERT(sizeof(dec1) == 4); *buf=mi_sint4korr(from) ^ mask; + if (((uint32)*buf) > DIG_MAX) + goto err; if (buf > to->buf || *buf != 0) buf++; else @@ -1372,6 +1376,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale) { DBUG_ASSERT(sizeof(dec1) == 4); *buf=mi_sint4korr(from) ^ mask; + if (((uint32)*buf) > DIG_MAX) + goto err; buf++; } if (frac0x) @@ -1387,10 +1393,17 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale) default: DBUG_ASSERT(0); } *buf=(x ^ mask) * powers10[DIG_PER_DEC1 - frac0x]; + if (((uint32)*buf) > DIG_MAX) + goto err; buf++; } my_afree(d_copy); return error; + +err: + my_afree(d_copy); + decimal_make_zero(((decimal_t*) to)); + return(E_DEC_BAD_NUM); } /* |