live555 icon indicating copy to clipboard operation
live555 copied to clipboard

Boolean seqNumLT(u_int16_t s1, u_int16_t s2) bug?

Open kim-dong-hyun opened this issue 1 year ago • 1 comments

The seqNumLT function source is as follows:

Boolean seqNumLT(u_int16_t s1, u_int16_t s2) { // a 'less-than' on 16-bit sequence numbers int diff = s2 - s1; if (diff > 0) { return (diff < 0x8000); } else if (diff < 0) { return (diff < -0x8000); } else { // diff == 0 return False; } }

The line return (diff < -0x8000); is intended to determine if s1 has rolled over when s1 is greater than s2. When the diff value is smaller, it does not necessarily imply a 'less-than' condition but rather a rollover situation. Therefore, it seems correct to modify this line to return (diff >= -0x8000); to accurately reflect the condition being checked.

kim-dong-hyun avatar Feb 07 '24 05:02 kim-dong-hyun