summaryrefslogtreecommitdiff
path: root/sql/records.cc
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2004-09-16 16:10:14 +0500
committerunknown <vva@eagle.mysql.r18.ru>2004-09-16 16:10:14 +0500
commitd47c79a0680ed5dee4d7373495e1481e31808311 (patch)
treede663f903c975e385fcc9977c2b628e869a80a0c /sql/records.cc
parent0d34c63536031ee2e104ec8cb94e5a1a3dd68ab4 (diff)
downloadmariadb-git-d47c79a0680ed5dee4d7373495e1481e31808311.tar.gz
Fixed Bug #5492 "set @@session.read_rnd_buffer_size=33554432"
crashes server on query incremented size of allocated buffer in the init_rr_cache(sql/records.cc) ( We are going to read the last three bytes of the buffer via uint3korr This macro reads actually 4 bytes (for speed) So, we have to allocate one more byte at the end of the buffer to avoid memory assertion fault ) sql/records.cc: incremented size of allocated buffer in the init_rr_cache ( We are going to read the last three bytes of the buffer via uint3korr This macro reads actually 4 bytes (for speed) So, we have to allocate one more byte at the end of the buffer to avoid memory assertion fault ) Fixed Bug #5492 "set @@session.read_rnd_buffer_size=33554432" crashes server on query
Diffstat (limited to 'sql/records.cc')
-rw-r--r--sql/records.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/records.cc b/sql/records.cc
index 415e75a467b..a2c6eb0a040 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -249,9 +249,15 @@ static int init_rr_cache(READ_RECORD *info)
rec_cache_size=info->cache_records*info->reclength;
info->rec_cache_size=info->cache_records*info->ref_length;
+ /*
+ We are going to read the last three bytes of the buffer via uint3korr
+ This macro reads actually 4 bytes (for speed)
+ So, we have to allocate one more byte at the end of the buffer
+ to avoid memory assertion fault
+ */
if (info->cache_records <= 2 ||
!(info->cache=(byte*) my_malloc_lock(rec_cache_size+info->cache_records*
- info->struct_length,
+ info->struct_length+1,
MYF(0))))
DBUG_RETURN(1);
#ifdef HAVE_purify