arm: Fix heap overflow issue in Neon64Load operation
authorAndreas Hansson <andreas.hansson@arm.com>
Thu, 26 May 2016 10:56:24 +0000 (11:56 +0100)
committerAndreas Hansson <andreas.hansson@arm.com>
Thu, 26 May 2016 10:56:24 +0000 (11:56 +0100)
This patch fixes an issue identified by ASAN where the Neon64Load
operation assumes the packet always contains 16 bytes.

Change-Id: If24a7e461d60cb80970dfbe61d923d7d56926698
Reviewed-by: Giacomo Gabrielli <giacomo.gabrielli@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
src/arch/arm/isa/templates/neon64.isa

index 6356073c5bf90dcbe4260a55e8db1abe777d16d4..336187fd89d34fe8b870856195a838ce4e47f751 100644 (file)
@@ -332,7 +332,8 @@ def template NeonLoadCompleteAcc64 {{
         %(op_decl)s;
         %(op_rd)s;
 
-        MemUnion &memUnion = *(MemUnion *)pkt->getPtr<uint8_t>();
+        MemUnion memUnion { { } };
+        memcpy(&memUnion, pkt->getPtr<uint8_t>(), pkt->getSize());
 
         if (fault == NoFault) {
             %(memacc_code)s;