GNOME Bugzilla – Bug 641647
calling virtual methods with float inout args crashes on x86-64
Last modified: 2015-02-07 16:47:25 UTC
_g_callable_info_invoke accounts for the arg direction when determining the ffi type to use (using ffi_type_pointer for inout and out args), but g_callable_info_get_ffi_arg_types doesn't. This causes problems on at least x86-64 because ffi uses SSE registers for floats and general purpose registers for pointers, so when passing a float inout arg, the caller (using _g_callable_info_invoke) passes it in a general purpose register, but the closure (created with g_callable_info_prepare_closure, which calls g_callable_info_get_ffi_arg_types) expects it in an SSE register. As a result it dereferences a random pointer and crashes.
Created attachment 180208 [details] [review] Account for arg direction in g_callable_info_get_ffi_arg_types
Review of attachment 180208 [details] [review]: Looks good to me
Pushed as commit f19d246.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]