[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
avoid possible overflow?
From: |
Carles Pina i Estany |
Subject: |
avoid possible overflow? |
Date: |
Sun, 14 Feb 2010 00:05:10 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hello,
The common pattern when doing a search by bisection is something like:
+ current = min + (max - min) / 2;
Instead of the first natural idea:
- current = (max + min) / 2;
To avoid overflows.
In gettext/gettext.c it's used in the "incorrect" way. It's not a big
problem since would happen only with .mo files with lot of strings, like
number that int represents in that architecture divided by 2 (aprox
aprox.).
See the attached file for a patch if we want to patch.
Else I would at least add a comment that we simplified because we
consider that will not happen.
Thanks,
--
Carles Pina i Estany
http://pinux.info
gettext_overflow.patch
Description: Text Data
- avoid possible overflow?,
Carles Pina i Estany <=