From 8d37ef29990f26b9de0789ee34f88dbea4dd8ac8 Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 9 Jun 2021 14:48:28 +0300 Subject: [PATCH] Aria now marks not used varchar space with MEM_UNDEFINED on read. --- storage/maria/ma_blockrec.c | 6 +++++- storage/maria/ma_dynrec.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index ad4ffa349d0..a89ac966a75 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -4912,9 +4912,11 @@ int _ma_read_block_record2(MARIA_HA *info, uchar *record, case FIELD_VARCHAR: { ulong length; + uint pack_length __attribute__((unused)); if (column->length <= 256) { length= (uint) (uchar) (*field_pos++= *field_length_data++); + pack_length= 1; } else { @@ -4923,14 +4925,16 @@ int _ma_read_block_record2(MARIA_HA *info, uchar *record, field_pos[1]= field_length_data[1]; field_pos+= 2; field_length_data+= 2; + pack_length= 2; } #ifdef SANITY_CHECKS - if (length > column->length) + if (length > column->length - pack_length) goto err; #endif if (read_long_data(info, field_pos, length, &extent, &data, &end_of_data)) DBUG_RETURN(my_errno); + MEM_UNDEFINED(field_pos + length, column->length - length - pack_length); break; } case FIELD_BLOB: diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c index f36e7dd9363..7bd85ae5fd1 100644 --- a/storage/maria/ma_dynrec.c +++ b/storage/maria/ma_dynrec.c @@ -1297,6 +1297,8 @@ size_t _ma_rec_unpack(register MARIA_HA *info, register uchar *to, uchar *from, if (from+length > from_end) goto err; memcpy(to+pack_length, from, length); + MEM_UNDEFINED(to+pack_length + length, + column_length - length - pack_length); from+= length; min_pack_length--; continue;