Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by saagarjha on Friday August 05, 2022 @04:41PM
(#32361740)
If your architecture does not support this then you’re at risk whenever you make a function call.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by rhexs on Friday August 05, 2022 @08:13PM
(#32363455)
Backpedal harder!
Re:C99 doesn't need function bodies, or 'VLAs are Turing com...
by saagarjha on Friday August 05, 2022 @10:06PM
(#32364128)
I’m not backpedaling. If your environment has guard pages and does probing then it protects equally well against VLAs and function calls overflowing the stack. If it has neither then both are liable to overwrite other memory. Obviously I would prefer that you have the protections, or some sort of equivalent, but they have nothing to do with VLAs.
Maybe. If the architecture supports protected memory and the compiler has placed an appropriately sized guard page below the stack. If it doesn't then overflowing the stack via a VLA gives you easy read and write access to any byte in program memory.