]> source.dussan.org Git - tigervnc.git/commit
Fix wrap-aware isAfter function in Congestion.cxx 817/head
authorLoic Prylli <lprylli@netflix.com>
Wed, 10 Apr 2019 21:25:35 +0000 (14:25 -0700)
committerLoic Prylli <lprylli@netflix.com>
Sat, 27 Apr 2019 01:56:08 +0000 (01:56 +0000)
commit95c46d8b7b03b1e0fce5169e78474cb2163ccde4
treed4ed8ff76a116bb6a38e47ea0e2514656ae493d8
parent005db3528df041d1bbd69a07fa41ef7ea4404c19
Fix wrap-aware isAfter function in Congestion.cxx

Result of overflow on signed integer arithmetic is undefined in C/C++ standard.
So in previous version clang was compiling the statement as (int)a > (int)b (i.e. assuming no overflow), which leads to incorrect result.

Correct deterministic behavior means doing overflow arithmetic as unsigned, i.e.
 a != b && a - b <= UINT_MAX / 2
common/rfb/Congestion.cxx