mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
cf7c0038a4
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>
The files in this directory come from the xdiff implementation in git. You can find it here: https://github.com/git/git/tree/master/xdiff The files were last updated November 17, 2025 from git release v.2.52.0 This is originally based on libxdiff, which can be found here: http://www.xmailserver.org/xdiff-lib.html The git version was used because it has been maintained and improved. And since it's part of git it is expected to be reliable. The code is distributed under the GNU LGPL license. It is included in the COPYING file. Changes in these files were made to avoid compiler warnings, replacing function calls into Git core with Vim ones, and removing unused code such as xmerge. The /* */ comments are kept to make syncing to a newer version easier, do not change them to // comments! The first work for including xdiff in Vim was done by Christian Brabandt.