summaryrefslogtreecommitdiff
path: root/sql/sql_analyse.cc
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-01-14 10:05:14 +0100
committerTor Didriksen <tor.didriksen@oracle.com>2011-01-14 10:05:14 +0100
commit7bf234032a6debc28f24fbbffe7e3cacb7b1803b (patch)
treea6039675e5fcc73cb3cde80664b6c2e4f1f83294 /sql/sql_analyse.cc
parentff2b529918c2c12d4a29f8f34c5d9afbf5e40464 (diff)
downloadmariadb-git-7bf234032a6debc28f24fbbffe7e3cacb7b1803b.tar.gz
Bug #59241 invalid memory read in do_div_mod with doubly assigned variables
Fix: copy my_decimal by value, to avoid dangling pointers. mysql-test/r/func_math.result: New test case. mysql-test/t/func_math.test: New test case. sql/item_cmpfunc.cc: No need to call fix_buffer_pointer() anymore. sql/item_func.cc: Copy my_decimal by value, to avoid dangling pointers. sql/my_decimal.h: Implement proper copy constructor and assignment operator for my_decimal. sql/sql_analyse.cc: No need to call fix_buffer_pointer() anymore. strings/decimal.c: Remove #line directive: it messes up TAGS and it confuses gdb when debugging.
Diffstat (limited to 'sql/sql_analyse.cc')
-rw-r--r--sql/sql_analyse.cc7
1 files changed, 1 insertions, 6 deletions
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 4b6756188dd..e3c0ed28052 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2006 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -521,9 +521,6 @@ void field_decimal::add()
{
found = 1;
min_arg = max_arg = sum[0] = *dec;
- min_arg.fix_buffer_pointer();
- max_arg.fix_buffer_pointer();
- sum[0].fix_buffer_pointer();
my_decimal_mul(E_DEC_FATAL_ERROR, sum_sqr, dec, dec);
cur_sum= 0;
min_length = max_length = length;
@@ -545,12 +542,10 @@ void field_decimal::add()
if (my_decimal_cmp(dec, &min_arg) < 0)
{
min_arg= *dec;
- min_arg.fix_buffer_pointer();
}
if (my_decimal_cmp(dec, &max_arg) > 0)
{
max_arg= *dec;
- max_arg.fix_buffer_pointer();
}
}
}