summaryrefslogtreecommitdiff
path: root/sql/records.cc
diff options
context:
space:
mode:
authorKarthik Kamath <karthik.kamath@oracle.com>2017-03-09 14:57:20 +0530
committerKarthik Kamath <karthik.kamath@oracle.com>2017-03-09 14:57:20 +0530
commitaf84921d263b8bb1d1a06989794db07394f94e21 (patch)
tree218873d2cace3e406e8ac03d81f35882b03db927 /sql/records.cc
parente619295e1b480a24ee9740641ce69b8a412e1fc9 (diff)
downloadmariadb-git-af84921d263b8bb1d1a06989794db07394f94e21.tar.gz
BUG#24807826: UINT3KORR SHOULD STOP READING FOUR INSTEAD OF
THREE BYTES ON X86 Analysis: ========= The macro uint3korr reads 4 bytes of data instead of 3 on on x86 machines. Multiple definitions were created for this macro for optimization in WIN32. The idea was to optimize reading of 3 byte ints by reading an ordinary int and masking away the unused byte. However this is an undefined behavior. It will be an issue unless users are aware of allocating an extra byte for using this macro. Fix: ==== Removing the definition which reads 4 bytes of data. The only definition of this macro would now read just 3 bytes of data thus prohibiting the usage of an extra byte. Note: ===== This is a backport of Patches #5 and #6 for Bug#17922198.
Diffstat (limited to 'sql/records.cc')
-rw-r--r--sql/records.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/records.cc b/sql/records.cc
index 7f74b84b2d7..ae7ec74c17d 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -589,10 +589,9 @@ static int init_rr_cache(THD *thd, READ_RECORD *info)
rec_cache_size= info->cache_records*info->reclength;
info->rec_cache_size= info->cache_records*info->ref_length;
- // We have to allocate one more byte to use uint3korr (see comments for it)
if (info->cache_records <= 2 ||
!(info->cache=(uchar*) my_malloc_lock(rec_cache_size+info->cache_records*
- info->struct_length+1,
+ info->struct_length,
MYF(0))))
DBUG_RETURN(1);
#ifdef HAVE_purify