[Commits] 44f3058: Prevent undefined behavior if the table is already initialized

Vicentiu Ciorbaru vicentiu at mariadb.org
Tue Sep 20 15:17:51 EEST 2016


revision-id: 44f3058f54fa237ce9df7da2b18283a47b5b655e (mariadb-10.0.27-11-g44f3058)
parent(s): 83d5b963bd38e327a673c5d4f4d70c8223f45dd2
author: Vicențiu Ciorbaru
committer: Vicențiu Ciorbaru
timestamp: 2016-09-20 14:16:18 +0200
message:

Prevent undefined behavior if the table is already initialized

The error variable ends up not initialized if the first statement in the
if clause is false. This leads to us returning a result based on an
unitialized value.

---
 sql/records.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sql/records.cc b/sql/records.cc
index a37f7a1..940fd97 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -69,7 +69,7 @@ static int rr_index_desc(READ_RECORD *info);
 bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
                           bool print_error, uint idx, bool reverse)
 {
-  int error;
+  int error= 0;
   DBUG_ENTER("init_read_record_idx");
 
   empty_record(table);


More information about the commits mailing list