[Commits] 00c30e5: MDEV-11645: archive.archive fails in buildbot with valgrind (Use of uninitialised value)

Varun varunraiko1803 at gmail.com
Wed Mar 1 04:20:01 EET 2017


revision-id: 00c30e5a234fbd01484cd069c01e97c075025323 (mariadb-10.2.3-283-g00c30e5)
parent(s): b13cee83f9cfcffa98d227c492411a9acec85f42
author: Varun Gupta
committer: Varun Gupta
timestamp: 2017-03-01 07:46:26 +0530
message:

MDEV-11645: archive.archive fails in buildbot with valgrind (Use of uninitialised value)

Set null values to record_buffer->buffer for the VARCHAR fields

---
 storage/archive/ha_archive.cc | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 9d6d100..5599b43 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -372,10 +372,25 @@ int Archive_share::write_v1_metafile()
 
 unsigned int ha_archive::pack_row_v1(uchar *record)
 {
+  uint offset;
   uint *blob, *end;
   uchar *pos;
   DBUG_ENTER("pack_row_v1");
   memcpy(record_buffer->buffer, record, table->s->reclength);
+  for(Field** field= table->field; (*field) ; field++)
+  {
+    Field *fld= *field;
+    if (fld->type() == MYSQL_TYPE_VARCHAR)
+    {
+      if (!(fld->is_real_null(record - table->record[0])))
+      {
+        ptrdiff_t  start= (fld->ptr - table->record[0]);
+        Field_varstring *const field_var= (Field_varstring *)fld;
+        offset= field_var->data_length() + field_var->length_size();
+        bzero(record_buffer->buffer + start + offset, fld->field_length - offset + 1);
+      }
+    }
+  }
   pos= record_buffer->buffer + table->s->reclength;
   for (blob= table->s->blob_field, end= blob + table->s->blob_fields;
        blob != end; blob++)


More information about the commits mailing list