integer overflow check

jes at posteo.de jes at posteo.de
Mon Dec 15 13:08:27 PST 2014


Am 15.12.2014 19:34 schrieb Alan Coopersmith:
> With traditional C compilers, it wouldn't matter if we checked for 
> overflow
> after REQUEST_FIXED_SIZE, since REQUEST_FIXED_SIZE isn't doing anything 
> risky
> with the results, such as allocating memory.
> 
Yes, I've seen that in the code, but undefined behavior is something 
that should be avoided.

> Newer compilers which require programmers to pay strict attention to 
> the
> minutia of the language and may optimize out overflow checks assuming 
> they
> couldn't possibly be needed after we already used the results can cause
> problems in code like X that were written decades ago and working until 
> now.

It's still better to have the checks.
You didn't say anything to my code.
The overflow is more likely in the 2nd part of the patch.


More information about the xorg-devel mailing list