From: Tim Kientzle Date: Sun, 8 Nov 2009 22:28:50 +0000 (-0500) Subject: If you overflow an int64_t, use INT64_MAX, not UINT64_MAX. X-Git-Tag: v2.8.0~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59fec1eef1b25c484c4bb40f3df2faad526b4a3a;p=thirdparty%2Flibarchive.git If you overflow an int64_t, use INT64_MAX, not UINT64_MAX. SVN-Revision: 1613 --- diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c index 6328c4d8f..f9ae245be 100644 --- a/libarchive/archive_read_support_format_mtree.c +++ b/libarchive/archive_read_support_format_mtree.c @@ -1159,7 +1159,7 @@ mtree_atol10(char **p) digit = **p - '0'; while (digit >= 0 && digit < base) { if (l > limit || (l == limit && digit > last_digit_limit)) { - l = UINT64_MAX; /* Truncate on overflow. */ + l = INT64_MAX; /* Truncate on overflow. */ break; } l = (l * base) + digit; @@ -1200,7 +1200,7 @@ mtree_atol16(char **p) digit = -1; while (digit >= 0 && digit < base) { if (l > limit || (l == limit && digit > last_digit_limit)) { - l = UINT64_MAX; /* Truncate on overflow. */ + l = INT64_MAX; /* Truncate on overflow. */ break; } l = (l * base) + digit; diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index b2700ba42..716ecd79e 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -1630,7 +1630,7 @@ pax_time(const char *p, int64_t *ps, long *pn) digit = *p - '0'; if (s > limit || (s == limit && digit > last_digit_limit)) { - s = UINT64_MAX; + s = INT64_MAX; break; } s = (s * 10) + digit; @@ -1929,7 +1929,7 @@ gnu_sparse_10_atol(struct archive_read *a, struct tar *tar, return (ARCHIVE_WARN); digit = *p - '0'; if (l > limit || (l == limit && digit > last_digit_limit)) - l = UINT64_MAX; /* Truncate on overflow. */ + l = INT64_MAX; /* Truncate on overflow. */ else l = (l * base) + digit; p++; @@ -2035,7 +2035,7 @@ tar_atol8(const char *p, unsigned char_cnt) digit = *p - '0'; while (digit >= 0 && digit < base && char_cnt-- > 0) { if (l>limit || (l == limit && digit > last_digit_limit)) { - l = UINT64_MAX; /* Truncate on overflow. */ + l = INT64_MAX; /* Truncate on overflow. */ break; } l = (l * base) + digit; @@ -2071,7 +2071,7 @@ tar_atol10(const char *p, unsigned char_cnt) digit = *p - '0'; while (digit >= 0 && digit < base && char_cnt-- > 0) { if (l > limit || (l == limit && digit > last_digit_limit)) { - l = UINT64_MAX; /* Truncate on overflow. */ + l = INT64_MAX; /* Truncate on overflow. */ break; } l = (l * base) + digit;