summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-07-18 09:47:39 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2011-07-18 09:47:39 +0200
commit1a02a372432cbf023fa9291badf772f0f2bc55fd (patch)
tree37187748a0115566d143768c77b6f6757a37739a /strings
parent2d76226f062659e83ed570ee1c8e3c21517969a6 (diff)
downloadmariadb-git-1a02a372432cbf023fa9291badf772f0f2bc55fd.tar.gz
Bug#12537160 ASSERTION FAILED: STOP0 <= &TO->BUF[TO->LEN] WITH LARGE NUMBER.
Turns out the DBUG_ASSERT added by fix for Bug#11792200 was overly pessimistic: 'stop0' is used in the main loop of do_div_mod, but we only dereference 'buf0' for div operations, not for mod. mysql-test/r/func_math.result: New test case. mysql-test/t/func_math.test: New test case. strings/decimal.c: Move DBUG_ASSERT down to where we actually dereference the loop pointer.
Diffstat (limited to 'strings')
-rw-r--r--strings/decimal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index da5888e7b0d..b18a8c3fa50 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -2182,7 +2182,6 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2,
}
buf0=to->buf;
stop0=buf0+intg0+frac0;
- DBUG_ASSERT(stop0 <= &to->buf[to->len]);
if (likely(div_mod))
while (dintg++ < 0 && buf0 < &to->buf[to->len])
{
@@ -2277,7 +2276,10 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2,
}
}
if (likely(div_mod))
+ {
+ DBUG_ASSERT(buf0 < to->buf + to->len);
*buf0=(dec1)guess;
+ }
dcarry= *start1;
start1++;
}