lchan->s and integer overflow

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther holger at freyther.de
Wed Mar 13 16:49:15 UTC 2013


On Wed, Mar 13, 2013 at 05:02:02PM +0100, Peter Stuge wrote:

> It avoids the problem, but why is it safe?
> 
> The mere possibility that the counter can become negative suggests
> an imbalance somewhere in the code - but I don't know if that's the
> case, which is why I ask.

Exactly, the point is that the current code is broken. And in general
using OSMO_MIN/OSMO_MAX is better than hand rolling code. And if a range
is from a to b it is better to clamp it on both sides that just one.

For this specific issue. I wouldn't mind making the value '0' illegal,
GSM 12.21 doesn't specify the legal range and as '0' and '1' will behave
the same with the fixed code it does make sense to forbid '0'.

Anyway, the current code is broken so Andreas please fix it ASAP.

holger




More information about the OpenBSC mailing list