From 477f474be3edf19a4da96d246b253e2b2ca0ce12 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 29 Dec 2015 20:18:24 -0800 Subject: [PATCH] Align struct access to struct address, not memory. --- Execute.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Execute.cpp b/Execute.cpp index d25f7b6..41550ba 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -793,6 +793,7 @@ void Array::PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *dat void Aggregate::PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const { _assert(!overlap); + size_t offset(0); uint8_t *base(reinterpret_cast(data)); JSObjectRef aggregate(JSValueIsObject(context, value) ? (JSObjectRef) value : NULL); for (size_t index(0); index != signature.count; ++index) { @@ -814,8 +815,9 @@ void Aggregate::PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void } } - element->type->PoolFFI(pool, context, field, base, rhs); - base += field->size; + element->type->PoolFFI(pool, context, field, base + offset, rhs); + offset += field->size; + CYAlign(offset, field->alignment); } } -- 2.47.2