From 28fd74742bd03647a5f772a508ef17f6cd8c2bf4 Mon Sep 17 00:00:00 2001 From: wiredfool <eric-github@soroos.net> Date: Thu, 4 Feb 2016 06:57:57 -0800 Subject: [PATCH] input parameter filtering --- Tests/test_image_resample.py | 20 +++++++++++++++++++- _imaging.c | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/_imaging.c b/_imaging.c index 3f86938..7bda38a 100644 --- a/_imaging.c +++ b/_imaging.c @@ -1532,6 +1532,10 @@ _resize(ImagingObject* self, PyObject* args) imIn = self->image; + if (xsize < 1 || ysize < 1) { + return ImagingError_ValueError("height and width must be > 0"); + } + imOut = ImagingNew(imIn->mode, xsize, ysize); if (imOut) (void) ImagingResize(imOut, imIn, filter);