[PATCH 2/2] os: Work around integer overflow in TimerSet.
fcarrijo at freedesktop.org
Sun Mar 6 12:34:25 PST 2011
Cyril Brulebois <kibi at debian.org> wrote:
> If TimerSet gets called with a big timeout, this call can overflow:
> millis += now;
> Detect overflow and set millis to the maximal integer when that happens,
> to avoid falling in the “already expired” case.
I found this, buried in Section 6.2.5 (9) of the C Standard:
A computation involving unsigned operands can never overflow,
because a result that cannot be represented by the resulting
unsigned integer type is reduced modulo the number that is one
greater than the largest value that can be represented by the
So, I presume, something isn't quite right in this series.
More information about the xorg-devel