summaryrefslogtreecommitdiff
path: root/git-gui/lib/class.tcl
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-04-17 12:49:36 +0200
committerJunio C Hamano <gitster@pobox.com>2025-04-17 08:15:15 -0700
commit8f282bdff0b49744b45d619075b59a5e8b596613 (patch)
treed5db95061340804ca8718d2ba92171894ad12e3b /git-gui/lib/class.tcl
parent5b97a56fa0e7d580dc8865b73107407c9b3f0eff (diff)
parse: fix off-by-one for minimum signed values
We accept a maximum value in `git_parse_signed()` that restricts the range of accepted integers. As the intent is to pass `INT*_MAX` values here, this maximum doesn't only act as the upper bound, but also as the implicit lower bound of the accepted range. This lower bound is calculated by negating the maximum. But given that the maximum value of a signed integer with N bits is `2^(N-1)-1` whereas the minimum value is `-2^(N-1)` we have an off-by-one error in the lower bound. Fix this off-by-one error by using `-max - 1` as lower bound instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-gui/lib/class.tcl')
0 files changed, 0 insertions, 0 deletions