diff options
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc index bdaaecc2026..fbce8b9041d 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8446,7 +8446,10 @@ int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr, b_length=get_length(b_ptr); if (b_length > max_length) b_length=max_length; - diff=memcmp(a,b,MY_MIN(a_length,b_length)); + if (uint32 len= MY_MIN(a_length,b_length)) + diff= memcmp(a,b,len); + else + diff= 0; return diff ? diff : (int) (a_length - b_length); } @@ -8503,7 +8506,8 @@ uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg) length=(uint) blob_length; } int2store(buff,length); - memcpy(buff+HA_KEY_BLOB_LENGTH, blob, length); + if (length) + memcpy(buff+HA_KEY_BLOB_LENGTH, blob, length); return HA_KEY_BLOB_LENGTH+length; } |