Source code
Revision control
Copy as Markdown
Other Tools
diff --git a/js/src/ctypes/libffi/src/aarch64/ffi.c b/js/src/ctypes/libffi/src/aarch64/ffi.c
index 1ebf43c192afe..a0a8c69dacf8b 100644
--- a/js/src/ctypes/libffi/src/aarch64/ffi.c
+++ b/js/src/ctypes/libffi/src/aarch64/ffi.c
@@ -638,22 +638,23 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
if (state.ngrn < N_X_ARG_REG)
context->x[state.ngrn++] = ext;
else
{
void *d = allocate_to_stack (&state, stack, ty->alignment, s);
state.ngrn = N_X_ARG_REG;
/* Note that the default abi extends each argument
to a full 64-bit slot, while the iOS abi allocates
- only enough space. */
+ only enough space, except for variadic arguments. */
#ifdef __APPLE__
- memcpy(d, a, s);
-#else
- *(ffi_arg *)d = ext;
+ if (!state.allocating_variadic)
+ memcpy(d, a, s);
+ else
#endif
+ *(ffi_arg *)d = ext;
}
}
break;
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
case FFI_TYPE_LONGDOUBLE:
case FFI_TYPE_STRUCT: