1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug#35272: @@global.key_buffer_size = 4294967295 let the server crash

When trying to get the requested amount of memory for the keybuffer,
the out of memory could be signaled if one of the tentative allocations
fail. Later the server would crash (debug assert) when trying to send
a ok packet with a error set.

The solution is only to signal the error if all tentative allocations
for the keybuffer fail.


mysql-test/r/key_cache.result:
  Add test case result for Bug#35272
mysql-test/t/key_cache.test:
  Add test case for Bug#35272
mysys/mf_keycache.c:
  Don't set error on my_large_malloc if allocation fails.
  Set the error if all tentative allocations failed.
This commit is contained in:
unknown
2008-03-25 15:53:57 -03:00
parent 2d5a444d1f
commit c3641cd513
3 changed files with 33 additions and 1 deletions

View File

@ -247,3 +247,28 @@ SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
DROP TABLE t1;
# End of 4.1 tests
#
# Bug#35272: @@global.key_buffer_size = 4294967295 let the server crash
#
SET @save_key_buffer = @@global.key_buffer_size;
# Wee try to force Out Of Memory here. key_buffer_size is ULL, so
# on a 32 bit machine, 4GB is the most we can ask for before the
# server complains about value/variable mismatch. At the off chance
# of one of our 64-bit machines actually offering us 4GB, we also
# accept "no error" (in addition to the expected "out of memory").
--error 0,ER_OUTOFMEMORY
SET @@global.key_buffer_size = 4294967295;
# on 32-bit, we get "out of range", on 64-bit, "out of memory".
--error 0,ER_WRONG_ARGUMENTS,ER_OUTOFMEMORY
--disable_warnings
SET @@global.key_buffer_size = 9223372036854775807;
--enable_warnings
# restore normal value, just in case we got the 4GB or something.
SET @@global.key_buffer_size = @save_key_buffer;
--echo End of 5.1 tests