]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1926: xdiff: Coverity warning with MAX_CNT/UINT_MAX usage v9.1.1926
authorYee Cheng Chin <ychin.git@gmail.com>
Sun, 23 Nov 2025 19:24:10 +0000 (19:24 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 23 Nov 2025 19:24:10 +0000 (19:24 +0000)
commitcf7c0038a4c999409264559c085a7c8d293cdf8a
treebb07562a6cc5f165ebfd0290adb5511f978b85a6
parent898ac80be6fbeb24a105bd3105061b692db89a1a
patch 9.1.1926: xdiff: Coverity warning with MAX_CNT/UINT_MAX usage

Problem:  xdiff: Coverity warning with MAX_CNT/UINT_MAX usage
          (after v9.1.1921)
Solution: Replace XDL_MIN macro to a manual check.
          (Yee Cheng Chin)

In the recent xdiff upstream sync (#18765), MAX_CNT in xhistogram was
switched back to using UINT_MAX to match upstream. This exposed an issue
in xdiff that using using min() to compare against the max integer will
not work as the number will just overflow. Switch the check to be done
in a saturating add that respects integer overflow.

related: #18765
closes: #18792

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/version.c
src/xdiff/xhistogram.c