3 ms·
>> Falsehood #28. At least it won't completely wipe the drive. > This is just unhelpful for anyone trying to learn more about UB. [...] And if you literally wr
by nayuki 4y ago
>> Falsehood #28. At least it won't completely wipe the drive.
> This is just unhelpful for anyone trying to learn more about UB. [...] And if you literally write "rm -rf /" in these dead sections, then yeah, I guess UB is technically wiping your drive, but stating it like that just gets in the way of anyone trying to learn more about UB and just perpetrates this unhelpful theory that UB can literally do anything it wants
The example is contrived, yes. But even if the source code doesn't literally contain "rm -rf /", if the program contains a buffer overflow vulnerability, then someone can craft an input to inject arbitrary code/commands into the program execution and still effect a deletion anyway. So yes, UB really does mean anything can happen.