Skip to content

[graph] Correct function pointer types

Ben Wagner requested to merge bungeman/freetype-demos:fix_icall into master

Building the demos with the CFI sanitizer detects a number of uses of undefined behavior in the Minimalist Graphics Subsystem where an indirect function call is made through a pointer of a different type. All of these cases worked in practice since the differing argument types were the same size and would have the same pointer value at runtime.

Change the functions to take the correct types and downcast inside the function.

  • graph/beos/grbeos.cpp: remove casts

  • graph/mac/grmac.c: correct return type of listen_event, remove casts

  • graph/os2/gros2pm.c: correct function signatures, downcast inside functions, remove function pointer casts

  • graph/win32/grwin32.c: ditto

  • graph/x11/grx11.c: ditto

Edited by Ben Wagner

Merge request reports

Loading