removed redundant check

This commit is contained in:
wiredfool 2016-06-16 01:09:38 -07:00
parent 8aedf8b1d8
commit 95f464f827

View File

@ -98,17 +98,13 @@ ImagingPrecompute(int inSize, int outSize, struct filter *filterp,
if (outSize > INT_MAX / (kmax * sizeof(double))) if (outSize > INT_MAX / (kmax * sizeof(double)))
return 0; return 0;
// sizeof(double) should be greater than 0 as well
if (outSize > INT_MAX / (2 * sizeof(int)))
return 0;
/* coefficient buffer */ /* coefficient buffer */
/* malloc check ok, overflow checked above */ /* malloc check ok, overflow checked above */
kk = malloc(outSize * kmax * sizeof(double)); kk = malloc(outSize * kmax * sizeof(double));
if ( ! kk) if ( ! kk)
return 0; return 0;
/* malloc check ok, overflow checked above */ /* malloc check ok, kmax*sizeof(double) > 2*sizeof(int) */
xbounds = malloc(outSize * 2 * sizeof(int)); xbounds = malloc(outSize * 2 * sizeof(int));
if ( ! xbounds) { if ( ! xbounds) {
free(kk); free(kk);