diff options
author | Rasmus Villemoes <rv@rasmusvillemoes.dk> | 2016-12-06 19:53:37 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-07 15:44:31 -0800 |
commit | 381aa8e73070646933520e1133a81ab4ba383891 (patch) | |
tree | 5b01c4654b226888dbb6a8cd12e9b61e57b36ebc /wrapper.c | |
parent | f2386c6b77e236fc104d3a024e5d314c23a941eb (diff) | |
download | git-381aa8e73070646933520e1133a81ab4ba383891.tar.gz git-381aa8e73070646933520e1133a81ab4ba383891.tar.xz |
shallow.c: avoid theoretical pointer wrap-around
The expression info->free+size is technically undefined behaviour in
exactly the case we want to test for. Moreover, the compiler is likely
to translate the expression to
(unsigned long)info->free + size > (unsigned long)info->end
where there's at least a theoretical chance that the LHS could wrap
around 0, giving a false negative.
This might as well be written using pointer subtraction avoiding these
issues.
Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrapper.c')
0 files changed, 0 insertions, 0 deletions