From e507f0b1d299f3bd4fb99fe767892150fced33fd Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Thu, 7 Jul 2016 18:22:04 +0300 Subject: [PATCH] Fix two minor complaints by cppcheck. --- libarchive/archive_ppmd7_private.h | 2 +- libarchive/test/test_fuzz.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libarchive/archive_ppmd7_private.h b/libarchive/archive_ppmd7_private.h index 3a6b9eb41..06c99e828 100644 --- a/libarchive/archive_ppmd7_private.h +++ b/libarchive/archive_ppmd7_private.h @@ -19,7 +19,7 @@ If you need the compatibility with original PPMd var.H, you can use external Ran #define PPMD7_MAX_ORDER 64 #define PPMD7_MIN_MEM_SIZE (1 << 11) -#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3) +#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFFu - 12 * 3) struct CPpmd7_Context_; diff --git a/libarchive/test/test_fuzz.c b/libarchive/test/test_fuzz.c index 76fda6282..602b89466 100644 --- a/libarchive/test/test_fuzz.c +++ b/libarchive/test/test_fuzz.c @@ -110,13 +110,17 @@ test_fuzz(const struct files *filesets) for (i = 0; filesets[n].names[i] != NULL; ++i) { tmp = slurpfile(&size, filesets[n].names[i]); - rawimage = (char *)realloc(rawimage, oldsize + size); + char *newraw = (char *)realloc(rawimage, oldsize + size); + if (!assert(newraw != NULL)) + { + free(rawimage); + continue; + } + rawimage = newraw; memcpy(rawimage + oldsize, tmp, size); oldsize += size; size = oldsize; free(tmp); - if (!assert(rawimage != NULL)) - continue; } } if (size == 0) -- 2.47.2