2 ms·
> The hack depends on numeric overflow in the caller that flips negative number into positive, so malloc can't possibly know it got the wrong size. Look again
by jancsika 7y ago
> The hack depends on numeric overflow in the caller that flips negative number into positive, so malloc can't possibly know it got the wrong size.
Look again at the hack-- Ted is sending a negative number to malloc. If I change malloc's interface to accept signed numbers, then I can check inside the definition for negative numbers and report to the user that something bad has happened.