summaryrefslogtreecommitdiff
path: root/mysys/safemalloc.c
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2009-04-29 13:51:10 +0200
committerVladislav Vaintroub <vvaintroub@mysql.com>2009-04-29 13:51:10 +0200
commit73d3be945ff5f224ae7197883617495a9e0002b2 (patch)
tree9590cb8e7034720efd1d753e79d501e9b760a805 /mysys/safemalloc.c
parent90815182f09d8c9647b8ce2f907b7e3d6b687375 (diff)
downloadmariadb-git-73d3be945ff5f224ae7197883617495a9e0002b2.tar.gz
Bug#43932 myisam index corruption with large index and large
key_buffer_size. The cause of corruption was number overflow when multiplying two ulong values, number of used keycache blocks with size of a single block. The result of multiplication exceeded ulong range (4G) and this lead to incorrectly calculated buffer offset in the key cache. The fix is to use size_t for multiplication result. This patch also fixes pointless cast in safemalloc (size of allocated block to uint), that creates lot of false alarm warnings when using big keycache (> 4GB) in debug mode.
Diffstat (limited to 'mysys/safemalloc.c')
-rw-r--r--mysys/safemalloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 36d07b475e9..c484f1d4c54 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -174,7 +174,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
data[size + 3]= MAGICEND3;
irem->filename= (char *) filename;
irem->linenum= lineno;
- irem->datasize= (uint32) size;
+ irem->datasize= size;
irem->prev= NULL;
/* Add this remember structure to the linked list */