mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-17 17:10:03 +00:00
Fixed bug #29769 (sys_check_timeouts: sys_now() may overflow)
This commit is contained in:
parent
abc36471d9
commit
71f5fdef42
@ -198,6 +198,10 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2010-05-05: Simon Goldschmidt
|
||||||
|
* def.h, timers.c: Fixed bug #29769 (sys_check_timeouts: sys_now() may
|
||||||
|
overflow)
|
||||||
|
|
||||||
2010-04-21: Simon Goldschmidt
|
2010-04-21: Simon Goldschmidt
|
||||||
* api_msg.c: Fixed bug #29617 (sometime cause stall on delete listening
|
* api_msg.c: Fixed bug #29617 (sometime cause stall on delete listening
|
||||||
connection)
|
connection)
|
||||||
|
@ -370,8 +370,8 @@ sys_check_timeouts(void)
|
|||||||
|
|
||||||
now = sys_now();
|
now = sys_now();
|
||||||
if (next_timeout) {
|
if (next_timeout) {
|
||||||
/* @todo: wrap around? */
|
/* this cares for wraparounds */
|
||||||
diff = now - timeouts_last_time;
|
diff = LWIP_U32_DIFF(now, timeouts_last_time);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
had_one = 0;
|
had_one = 0;
|
||||||
|
@ -47,6 +47,11 @@ extern "C" {
|
|||||||
#define NULL ((void *)0)
|
#define NULL ((void *)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Get the absolute difference between 2 u32_t values (correcting overflows)
|
||||||
|
* 'a' is expected to be 'higher' (without overflow) than 'b'. */
|
||||||
|
#define LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1)))
|
||||||
|
|
||||||
|
/* Endianess-optimized shifting of two u8_t to create one u16_t */
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
#define LWIP_MAKE_U16(a, b) ((a << 8) | b)
|
#define LWIP_MAKE_U16(a, b) ((a << 8) | b)
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user