From 9e44ef13086672f2e852cd2ad6ae3ed658f999dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Fri, 25 Nov 2016 17:02:30 +0200 Subject: [PATCH] Fix connect.upd test in armhf The problem was caused by a missaligned double value access. Make use of memcpy instead. --- debian/patches/armhf_upd_fail.patch | 27 +++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 28 insertions(+) create mode 100644 debian/patches/armhf_upd_fail.patch diff --git a/debian/patches/armhf_upd_fail.patch b/debian/patches/armhf_upd_fail.patch new file mode 100644 index 000000000..d5d85e0da --- /dev/null +++ b/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 + +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::GetTypedValue(PVBLK blk, int n) + template + void TYPVAL::SetBinValue(void *p) + { +- Tval = *(TYPE *)p; ++ memcpy(&Tval, p, sizeof(TYPE)); + Null = false; + } // end of SetBinValue + +@@ -819,7 +819,7 @@ bool TYPVAL::GetBinValue(void *buf, int buflen, bool go) + //#endif + + if (go) +- *(TYPE *)buf = Tval; ++ memcpy(buf, &Tval, sizeof(TYPE)); + + Null = false; + return false; diff --git a/debian/patches/series b/debian/patches/series index a341176e7..525b99935 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -21,3 +21,4 @@ mips-connect-unaligned.patch mips-machine.patch mips-unstable-tests.patch hurd_socket.patch +armhf_upd_fail.patch