diff options
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/field.cc b/sql/field.cc index d840034f8dc..3d3f698f912 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -6992,8 +6992,18 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) return 0; } - if (from == value.ptr()) + /* + If the 'from' address is in the range of the temporary 'value'- + object we need to copy the content to a different location or it will be + invalidated when the 'value'-object is reallocated to make room for + the new character set. + */ + if (from >= value.ptr() && from <= value.ptr()+value.length()) { + /* + If content of the 'from'-address is cached in the 'value'-object + it is possible that the content needs a character conversion. + */ uint32 dummy_offset; if (!String::needs_conversion(length, cs, field_charset, &dummy_offset)) { |