From 06be03f77cc1dbd3f52232d98fbab2d220d93fc5 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Thu, 17 Dec 2009 09:55:03 +0400 Subject: Fix for bug#49465: valgrind warnings and incorrect live checksum... Problem: inserting a record we don't set unused null bits in the record buffer if no default field values used. That may lead to wrong live checksum calculation. Fix: set unused null bits in the record buffer in such cases. mysql-test/r/myisam.result: Fix for bug#49465: valgrind warnings and incorrect live checksum... - test result. mysql-test/t/myisam.test: Fix for bug#49465: valgrind warnings and incorrect live checksum... - test case. sql/sql_insert.cc: Fix for bug#49465: valgrind warnings and incorrect live checksum... - set unused null bits to 1 in the record buffer in case we don't call restore_record() before a fill_record() call (when no default values used). --- sql/sql_insert.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sql/sql_insert.cc') diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index b0958201795..76d4378a6f1 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -787,12 +787,21 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, restore_record(table,s->default_values); // Get empty record else { + TABLE_SHARE *share= table->s; + /* Fix delete marker. No need to restore rest of record since it will be overwritten by fill_record() anyway (and fill_record() does not use default values in this case). */ - table->record[0][0]= table->s->default_values[0]; + table->record[0][0]= share->default_values[0]; + + /* Fix undefined null_bits. */ + if (share->null_bytes > 1 && share->last_null_bit_pos) + { + table->record[0][share->null_bytes - 1]= + share->default_values[share->null_bytes - 1]; + } } if (fill_record_n_invoke_before_triggers(thd, table->field, *values, 0, table->triggers, -- cgit v1.2.1