Skip to content
Commit 558c967e authored by Jorge Olmos's avatar Jorge Olmos Committed by Victor Toso
Browse files

Avoid passing libusb functions as callbacks

When building spice-gtk for windows:
- libusb uses __stdcall calling convention when compiled for win32. It does
not include an option to be compiled with __cdecl calling convention.
Directly calling libusb functions works fine. But it is a problem when its
functions are passed as callbacks to a function that expects other calling
convention.
- glib uses __cdecl calling convention and expects the functions it
receives as parameters to follow __cdecl convention.

So the lines included in spice-gtk like:
     g_clear_pointer(&priv->device, libusb_unref_device);
cause libusb_unref_device (compiled with _stdcall convention) to be called
with __cdecl convention. This causes stack corruption, and hence crashes.

Related: https://gitlab.gnome.org/GNOME/glib/issues/1494


Acked-by: default avatarVictor Toso <victortoso@redhat.com>
parent 44f84a7f
Loading
Loading
Loading
Pipeline #3406 passed with stage
in 6 minutes and 5 seconds
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment