1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for Bug#56138 "valgrind errors about overlapping memory when double-assigning same variable",

and related small fixes.

mysql-test/t/user_var.test:
  test for bug
sql/field_conv.cc:
  From the C standard, memcpy() has undefined behaviour if to->ptr==from->ptr
sql/item_func.cc:
  In the case of BUG#56138, entry->value==ptr in which case memcpy()
  has undefined results per the C standard.
sql/sql_select.cc:
  Work around a bug in old gcc
This commit is contained in:
Guilhem Bichot
2010-11-22 09:57:59 +01:00
parent a6294cd5cb
commit 96b0404940
5 changed files with 19 additions and 8 deletions

View File

@ -4034,8 +4034,12 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
continue;
}
#ifdef HAVE_purify
/* Valgrind complains about overlapped memcpy when save_pos==use. */
#if defined(__GNUC__) && !MY_GNUC_PREREQ(4,4)
/*
Old gcc used a memcpy(), which is undefined if save_pos==use:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39480
*/
if (save_pos != use)
#endif
*save_pos= *use;