summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2018-01-30 21:05:27 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2018-01-30 21:13:24 +0200
commit5edd129fbf14eb56e793f84963b3b9e5770c4604 (patch)
tree30adcbe75decdbd45e114130a523249300913bc6
parentded07724eebb6c3afe882884fbad32e8dc907b0c (diff)
downloadmariadb-git-5edd129fbf14eb56e793f84963b3b9e5770c4604.tar.gz
Fix ASAN failure in main.lock (and others)
Whenever one copies an IO_CACHE struct, one must remember to call setup_io_cache, if not, the IO_CACHE's current_pos and end_pos self-references will point to the previous struct's memory, which could go out of scope. Commit 90038693903044bbbf7946ac128c3757ad33d7ba fixes this problem in a more general fashion by removing the self-references altogether, but for 5.5 we'll keep the old behaviour.
-rw-r--r--sql/sql_update.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index ede38468513..e42f6a4ff76 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -628,6 +628,8 @@ int mysql_update(THD *thd,
if (reinit_io_cache(&tempfile,READ_CACHE,0L,0,0))
error=1; /* purecov: inspected */
select->file=tempfile; // Read row ptrs from this file
+ // select->file was copied, update self-references.
+ setup_io_cache(&select->file);
if (error >= 0)
goto err;
}