From: Jay Freeman (saurik) Date: Wed, 30 Dec 2015 04:18:24 +0000 (-0800) Subject: Align struct access to struct address, not memory. X-Git-Tag: v0.9.590~118 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/477f474be3edf19a4da96d246b253e2b2ca0ce12 Align struct access to struct address, not memory. --- 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); } }