]> git.ipfire.org Git - thirdparty/git.git/commit - sha1-file.c
sha1_file: don't convert off_t to size_t too early to avoid potential die()
authorSteffen Prohaska <prohaska@zib.de>
Sun, 21 Sep 2014 10:03:26 +0000 (12:03 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Sep 2014 19:40:55 +0000 (12:40 -0700)
commit9079ab7cb6768fa04e086303f90be043b423cca4
tree9bc4b152b3a8b5ba3f4d81f64e4994b2c9373b46
parent9035d75a2be9d80d82676504d69553245017f6d4
sha1_file: don't convert off_t to size_t too early to avoid potential die()

xsize_t() checks if an off_t argument can be safely converted to
a size_t return value.  If the check is executed too early, it could
fail for large files on 32-bit architectures even if the size_t code
path is not taken.  Other paths might be able to handle the large file.
Specifically, index_stream_convert_blob() is able to handle a large file
if a filter is configured that returns a small result.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c