summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/my_global.h12
1 files changed, 1 insertions, 11 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 0d43964234b..695884cb6c6 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2001, 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
@@ -1064,19 +1064,9 @@ typedef char my_bool; /* Small bool */
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (*((long *) (A)))
#define uint2korr(A) (*((uint16 *) (A)))
-#if defined(HAVE_purify) && !defined(_WIN32)
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16))
-#else
-/*
- ATTENTION !
-
- Please, note, uint3korr reads 4 bytes (not 3) !
- It means, that you have to provide enough allocated space !
-*/
-#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
-#endif /* HAVE_purify && !_WIN32 */
#define uint4korr(A) (*((uint32 *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\