Malloc check merge/rebase

This commit is contained in:
wiredfool 2016-05-30 03:28:32 -07:00
parent 76605634e6
commit 92a13d975d

View File

@ -99,14 +99,16 @@ ImagingPrecompute(int inSize, int outSize, struct filter *filterp,
return 0; return 0;
// sizeof(double) should be greater than 0 as well // 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; return 0;
/* coefficient buffer */ /* coefficient buffer */
/* 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 */
xbounds = malloc(outSize * 2 * sizeof(int)); xbounds = malloc(outSize * 2 * sizeof(int));
if ( ! xbounds) { if ( ! xbounds) {
free(kk); free(kk);