News for hackers. Stuff that matters.
Re:Catch-23: The New C Standard Sets the World on Fire by GuB-42 on Saturday April 01, 2023 @11:20PM (#35406820)
UB can initiate the rise of zombie velociraptors.

  int n;
  printf("type 0 to stop the rise of zombie velociraptors");
  scanf("%d", &n);
  realloc(pre, n);
  if (n != 0) rise_zombie_velociraptors()
May result in velociraptors raising even if the user enters "0".

The reason is that because realloc(pre, 0) is UB, for the compiler, it cannot happen, so n can't be 0, so the n != 0 test can be optimized out, so, velociraptors.

There are no comments on this comment yet.