Skip to content

Commit

Permalink
Fix connect.upd test in armhf
Browse files Browse the repository at this point in the history
The problem was caused by a missaligned double value access. Make use of
memcpy instead.
  • Loading branch information
cvicentiu committed Nov 27, 2016
1 parent fd2d0b7 commit 9e44ef1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions debian/patches/armhf_upd_fail.patch
@@ -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;
1 change: 1 addition & 0 deletions debian/patches/series
Expand Up @@ -21,3 +21,4 @@ mips-connect-unaligned.patch
mips-machine.patch
mips-unstable-tests.patch
hurd_socket.patch
armhf_upd_fail.patch

0 comments on commit 9e44ef1

Please sign in to comment.