author | Jonathan Nieder <jrnieder@gmail.com> | |
Fri, 27 May 2011 10:18:33 +0000 (05:18 -0500) | ||
committer | Jonathan Nieder <jrnieder@gmail.com> | |
Wed, 15 Jun 2011 07:32:50 +0000 (02:32 -0500) | ||
commit | abe27c0cbd97bf6a693004ddb411392ed596a853 | |
tree | e1ec602814a171bdb4ea8bfaedf75faaea5aa615 | tree | snapshot |
parent | 157415a9a9589a1e8af28e68c6664d39c34877af | commit | diff |
vcs-svn: guard against overflow when computing preimage length
Signed integer overflow produces undefined behavior in C and off_t is
a signed type. For predictable behavior, add some checks to protect
in advance against overflow.
On 32-bit systems ftell as called by buffer_tmpfile_prepare_to_read
is likely to fail with EOVERFLOW when reading the corresponding
postimage, and this patch does not fix that. So it's more of a
futureproofing measure than a complete fix.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed integer overflow produces undefined behavior in C and off_t is
a signed type. For predictable behavior, add some checks to protect
in advance against overflow.
On 32-bit systems ftell as called by buffer_tmpfile_prepare_to_read
is likely to fail with EOVERFLOW when reading the corresponding
postimage, and this patch does not fix that. So it's more of a
futureproofing measure than a complete fix.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
vcs-svn/fast_export.c | diff | blob | history |