From 92a13d975d3282d727bfd7f8a2b2d4f940d4d9ac Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 30 May 2016 03:28:32 -0700 Subject: [PATCH] Malloc check merge/rebase --- libImaging/Resample.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libImaging/Resample.c b/libImaging/Resample.c index 23e39a2e4..3d3c9b4b1 100644 --- a/libImaging/Resample.c +++ b/libImaging/Resample.c @@ -99,14 +99,16 @@ ImagingPrecompute(int inSize, int outSize, struct filter *filterp, return 0; // sizeof(double) should be greater than 0 as well - if (outSize > INT_MAX / (2 * sizeof(double))) + if (outSize > INT_MAX / (2 * sizeof(int))) return 0; /* coefficient buffer */ + /* malloc check ok, overflow checked above */ kk = malloc(outSize * kmax * sizeof(double)); if ( ! kk) return 0; + /* malloc check ok, overflow checked above */ xbounds = malloc(outSize * 2 * sizeof(int)); if ( ! xbounds) { free(kk);