diff options
author | Ole André Vadla Ravnås <ole.andre.ravnas@tillitech.com> | 2014-07-26 00:11:06 +0200 |
---|---|---|
committer | Ole André Vadla Ravnås <ole.andre.ravnas@soundrop.com> | 2014-07-26 00:17:07 +0200 |
commit | 0f4e09d27dc175ce3e95d070b794351663c7220e (patch) | |
tree | 5020beadece2ce228b4ac1340345ebb40bef3f04 | |
parent | 1cee07be4712411baa5eb8af22698bc8443a6d6e (diff) | |
download | libffi-0f4e09d27dc175ce3e95d070b794351663c7220e.tar.gz |
Fix non-variadic CIF initialization for Apple/ARM64
Turns out `aarch64_nfixedargs` wasn't initialized in the non-variadic
case, resulting in undefined behavior when allocating arguments.
-rw-r--r-- | src/aarch64/ffi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c index b807a2d..05f1a13 100644 --- a/src/aarch64/ffi.c +++ b/src/aarch64/ffi.c @@ -779,6 +779,8 @@ ffi_prep_cif_machdep (ffi_cif *cif) } } + cif->aarch64_nfixedargs = 0; + return FFI_OK; } @@ -789,9 +791,13 @@ ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs, unsigned int ntotalargs) { + ffi_status status; + + status = ffi_prep_cif_machdep (cif); + cif->aarch64_nfixedargs = nfixedargs; - return ffi_prep_cif_machdep(cif); + return status; } #endif |