sizeof overflow -- well defined or UB? sizeof(int[(0, SIZE_MAX / sizeof(int) + 1)]) == 0
-
-
Replying to @ch3root
Alexander Cherepanov Retweeted CopperheadOS
IMO sizeof overflow is UB per C11 6.5p5 Rel'd: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68065 … https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68107 … Partially inspired byhttps://twitter.com/CopperheadSec/status/656946446239797248 …
Alexander Cherepanov added,
2 replies 0 retweets 3 likes -
Replying to @RichFelker
@RichFelker size_t size = SIZE_MAX / sizeof(int) + 2; int (*p)[size]; p = malloc(sizeof *p); What should the code do? Crash in line 2?1 reply 0 retweets 0 likes -
Replying to @RichFelker
@RichFelker It's surely preferable to state directly in std that objects with size > SIZE_MAX are UB (if it's indeed intended:-).1 reply 0 retweets 0 likes -
Replying to @ch3root
@RichFelker But it's not there yet. UB in sizeof overflow means dynamic oversized VLAs are effectively prohibited.2 replies 0 retweets 0 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.