Conversation

C PSA/periodic reminder: YOU CANNOT CALL A VARIADIC FUNCTION VIA AN EXPRESSION OF NON-VARIADIC FUNCTION TYPE MATCHING THE ARGS YOU WANT TO USE, OR VICE VERSA!
2
7
Replying to
By casting a function pointer? I'd never even thought to try it, but now that you mention it, I certainly wouldn't expect it to work, though it might by accident on ancient systems that always pass args on stack.
1
They added CFI as a security hardening feature and the debugging runtime support was implemented primarily for finding the bugs in order to enable it in production for hardening. It would make sense to have an UBSan sanitizer for finding the same mismatches with direct calls.
1
1
Show replies