Commit 8133349d authored by unknown's avatar unknown

mem0pool.c:

  Fix a memory corruption bug: in 32-bit computers, every 4 billionth malloc outside innodb_additional_mem_pool_size was mistreated when freeing the memory; this could corrupt the InnoDB additional mem pool and could have caused crashes anywhere, also inside MySQL, or even database corruption! the bug exists also in 3.23 and 4.1; workaround: configure innodb_additional_mem_pool_size big enough


innobase/mem/mem0pool.c:
  Fix a memory corruption bug: in 32-bit computers, every 4 billionth malloc outside innodb_additional_mem_pool_size was mistreated when freeing the memory; this could corrupt the InnoDB additional mem pool and could have caused crashes anywhere, also inside MySQL, or even database corruption! the bug exists also in 3.23 and 4.1; workaround: configure innodb_additional_mem_pool_size big enough
parent 527f80b8
...@@ -97,8 +97,6 @@ struct mem_pool_struct{ ...@@ -97,8 +97,6 @@ struct mem_pool_struct{
/* The common memory pool */ /* The common memory pool */
mem_pool_t* mem_comm_pool = NULL; mem_pool_t* mem_comm_pool = NULL;
ulint mem_out_of_mem_err_msg_count = 0;
/* We use this counter to check that the mem pool mutex does not leak; /* We use this counter to check that the mem pool mutex does not leak;
this is to track a strange assertion failure reported at this is to track a strange assertion failure reported at
mysql@lists.mysql.com */ mysql@lists.mysql.com */
...@@ -266,8 +264,6 @@ mem_pool_fill_free_list( ...@@ -266,8 +264,6 @@ mem_pool_fill_free_list(
if (i >= 63) { if (i >= 63) {
/* We come here when we have run out of space in the /* We come here when we have run out of space in the
memory pool: */ memory pool: */
mem_out_of_mem_err_msg_count++;
return(FALSE); return(FALSE);
} }
...@@ -460,17 +456,13 @@ mem_area_free( ...@@ -460,17 +456,13 @@ mem_area_free(
ulint size; ulint size;
ulint n; ulint n;
if (mem_out_of_mem_err_msg_count > 0) { /* It may be that the area was really allocated from the OS with
/* It may be that the area was really allocated from the regular malloc: check if ptr points within our memory pool */
OS with regular malloc: check if ptr points within
our memory pool */
if ((byte*)ptr < pool->buf if ((byte*)ptr < pool->buf || (byte*)ptr >= pool->buf + pool->size) {
|| (byte*)ptr >= pool->buf + pool->size) { ut_free(ptr);
ut_free(ptr);
return; return;
}
} }
area = (mem_area_t*) (((byte*)ptr) - MEM_AREA_EXTRA_SIZE); area = (mem_area_t*) (((byte*)ptr) - MEM_AREA_EXTRA_SIZE);
......
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