From 59fec1eef1b25c484c4bb40f3df2faad526b4a3a Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sun, 8 Nov 2009 17:28:50 -0500 Subject: [PATCH] If you overflow an int64_t, use INT64_MAX, not UINT64_MAX. SVN-Revision: 1613 --- libarchive/archive_read_support_format_mtree.c | 4 ++-- libarchive/archive_read_support_format_tar.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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; -- 2.47.3