[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #37166] memp_sanity check loops itself
From: |
Simon Goldschmidt |
Subject: |
[lwip-devel] [bug #37166] memp_sanity check loops itself |
Date: |
Wed, 22 Aug 2012 13:22:07 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1 |
Follow-up Comment #3, bug #37166 (project lwip):
> if (n == m && --c < 0)
>
> is not the same as
> if (n == m & --c < 0)
>
> but is equivalent to
> if (n == m)
> if (--c < 0)
Of course it is. But what's "cruel" about boolean operators?
That's what the code wants to do: when looping the inner loop, m==n may be
true exactly one time. If it's true more than once, we have a loop.
The problem is that we can have a loop without reaching m==n, so c is never
decremented.
I'll fix it by adding another counter that checks that considers "memp_num" as
maximum loop count.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?37166>
_______________________________________________
Nachricht gesendet von/durch Savannah
http://savannah.nongnu.org/