forked from ottok/mariadb-10.0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The problem was caused by a missaligned double value access. Make use of memcpy instead.
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Description: Prevent unaligned memory access on armhf in connect storage engine | ||
Make use of memcpy instead of straight pointer dereferencing. The surrounding | ||
code uses the same logic and should be fixed upstream. | ||
Author: Vicențiu Ciorbaru <vicentiu@mariadb.org> | ||
|
||
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp | ||
index 64d0e13..bef035d 100644 | ||
--- a/storage/connect/value.cpp | ||
+++ b/storage/connect/value.cpp | ||
@@ -796,7 +796,7 @@ uchar TYPVAL<uchar>::GetTypedValue(PVBLK blk, int n) | ||
template <class TYPE> | ||
void TYPVAL<TYPE>::SetBinValue(void *p) | ||
{ | ||
- Tval = *(TYPE *)p; | ||
+ memcpy(&Tval, p, sizeof(TYPE)); | ||
Null = false; | ||
} // end of SetBinValue | ||
|
||
@@ -819,7 +819,7 @@ bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go) | ||
//#endif | ||
|
||
if (go) | ||
- *(TYPE *)buf = Tval; | ||
+ memcpy(buf, &Tval, sizeof(TYPE)); | ||
|
||
Null = false; | ||
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters