Commit 64ce92b7 authored by unknown's avatar unknown

ha_innodb.cc:

  Prevent crash if MySQL calls rnd_end WITOUT calling rnd_init first: only restore active_index if it the old value was pushed in rnd_init
  Initialize active_index to a sensible value: prevent crash if we restore it to the original value after an table scan


sql/ha_innodb.cc:
  Prevent crash if MySQL calls rnd_end WITOUT calling rnd_init first: only restore active_index if it the old value was pushed in rnd_init
parent 2f156c69
......@@ -1182,6 +1182,9 @@ ha_innobase::open(
last_query_id = (ulong)-1;
active_index = 0;
active_index_before_scan = (uint)-1; /* undefined value */
if (!(share=get_share(name)))
DBUG_RETURN(1);
......@@ -2751,9 +2754,16 @@ ha_innobase::rnd_end(void)
/* out: 0 or error number */
{
/* Restore the old active_index back; MySQL may assume that a table
scan does not change active_index */
scan does not change active_index. We only restore the value if
MySQL has called rnd_init before: sometimes MySQL seems to call
rnd_end WITHOUT calling rnd_init. */
if (active_index_before_scan != (uint)-1) {
change_active_index(active_index_before_scan);
change_active_index(active_index_before_scan);
active_index_before_scan = (uint)-1;
}
return(index_end());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment