[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 11 15:33:13 PST 2024
efriedma-quic wrote:
C standard rules for va_arg: "[...] if *type* is not compatible with the type of the actual next argument [...], the behavior is undefined [...]". A struct is never compatible with an array, so yes , it's undefined. (See 6.2.7 for what constitutes a "compatible type".)
As a practical matter, breaking the "compatible type" rule can cause crashes or data corruption. Modern ABIs don't just pass everything on the stack.
https://github.com/llvm/llvm-project/pull/119563
More information about the cfe-commits
mailing list