From 3b7e4186283605a0c791811200e505bf9eeae886 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Tue, 9 Apr 2013 23:40:18 -0400 Subject: [PATCH] fix assert error when resampling an image to an invalid size (corrupted stamps) --- src/graphics/Graphics.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp index b9481895a..bacb421a7 100644 --- a/src/graphics/Graphics.cpp +++ b/src/graphics/Graphics.cpp @@ -344,6 +344,8 @@ pixel *Graphics::resample_img(pixel *src, int sw, int sh, int rw, int rh) float * samples[PIXELCHANNELS]; //Resampler for each colour channel + if (sourceWidth <= 0 || sourceHeight <= 0 || resultWidth <= 0 || resultHeight <= 0) + return NULL; resamplers[0] = new Resampler(sourceWidth, sourceHeight, resultWidth, resultHeight, Resampler::BOUNDARY_CLAMP, 0.0f, 1.0f, pFilter, NULL, NULL, filter_scale, filter_scale); samples[0] = new float[sourceWidth]; for (int i = 1; i < PIXELCHANNELS; i++)