Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 96a60a8

Browse files
committed
vcs-svn: suppress a signed/unsigned comparison warning
All callers pass a nonnegative delta_len, so the code is already safe. Add an assertion to ensure that remains so and add a cast to keep clang and gcc -Wsign-compare from worrying. Reported-by: David Barr <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]>
1 parent c68038e commit 96a60a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

vcs-svn/svndiff.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ static int error_short_read(struct line_buffer *input)
7777
static int read_chunk(struct line_buffer *delta, off_t *delta_len,
7878
struct strbuf *buf, size_t len)
7979
{
80+
assert(*delta_len >= 0);
8081
strbuf_reset(buf);
81-
if (len > *delta_len ||
82+
if (len > (uintmax_t) *delta_len ||
8283
buffer_read_binary(delta, buf, len) != len)
8384
return error_short_read(delta);
8485
*delta_len -= buf->len;
@@ -290,7 +291,7 @@ static int apply_one_window(struct line_buffer *delta, off_t *delta_len,
290291
int svndiff0_apply(struct line_buffer *delta, off_t delta_len,
291292
struct sliding_view *preimage, FILE *postimage)
292293
{
293-
assert(delta && preimage && postimage);
294+
assert(delta && preimage && postimage && delta_len >= 0);
294295

295296
if (read_magic(delta, &delta_len))
296297
return -1;

0 commit comments

Comments
 (0)