|
|
|
|
|
by GuB-42
1172 days ago
|
|
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. |
|