summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-05-29 16:36:16 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-05-29 16:52:12 +0300
commit18934fb58309f4491b34273b2781cce68f6d6e22 (patch)
treee9e43e81979561fd5aec9d17dddd5cb6ea02e93f /sql/sql_string.cc
parent8a42ad7a5d3168b7ce92a38652d77424336a32b8 (diff)
parent6aa50bad3947a0eab24fb029cd58f5945439e365 (diff)
downloadmariadb-git-18934fb58309f4491b34273b2781cce68f6d6e22.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r--sql/sql_string.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 64661f46a49..beff50bd1c5 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -187,7 +187,16 @@ bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
if (alloc(arg_length))
return TRUE;
DBUG_ASSERT(arg_length < UINT_MAX32);
- if ((str_length=arg_length))
+ if (Ptr == str && arg_length == uint32(str_length))
+ {
+ /*
+ This can happen in some cases. This code is here mainly to avoid
+ warnings from valgrind, but can also be an indication of error.
+ */
+ DBUG_PRINT("warning", ("Copying string on itself: %p %zu",
+ str, arg_length));
+ }
+ else if ((str_length=uint32(arg_length)))
memcpy(Ptr,str,arg_length);
Ptr[arg_length]=0;
str_charset=cs;