diff options
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 07194cb2e4f..bf5520955c9 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1390,12 +1390,17 @@ static uint make_sortkey(Sort_param *param, uchar *to, uchar *ref_pos, else { uchar *end= field->pack(to, field->ptr); - int sz= static_cast<int>(end - to); + DBUG_ASSERT(end >= to); + uint sz= static_cast<uint>(end - to); res_len += sz; if (packed_addon_fields) to+= sz; else + { + if (addonf->length > sz) + bzero(end, addonf->length - sz); // Make Valgrind/MSAN happy to+= addonf->length; + } } } if (packed_addon_fields) |