[tz] signed overflow

Richter, Jörg Joerg.Richter at pdv-FS.de
Mon Mar 9 16:08:37 UTC 2015


In time2sub() there is this code:

  } else {
    lo = 1;
    for (i = 0; i < (int) TYPE_BIT(time_t) - 1; ++i)
      lo *= 2;
    hi = -(lo + 1);
  }

The last *= 2 will overflow a signed integer time_t. This can be fixed with “lo = -1” instead of “lo = 1”.
This change seems to be consistent with the variable names.

- Jörg


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20150309/8edab668/attachment.htm>


More information about the tz mailing list