From fa9201b9c98b18ea18fbee1e5608f20335a02131 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 16 Oct 2007 15:27:33 +0100 Subject: [PATCH] [pdiff] Check for too small images. The Laplacian pyramid can only work on images larger than 3x3 due to the size of its convolution kernel. So if the image is too small return an error (-1) before attempting to construction the pyramid. --- test/pdiff/pdiff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/pdiff/pdiff.c b/test/pdiff/pdiff.c index b75312dfe..4f3226db3 100644 --- a/test/pdiff/pdiff.c +++ b/test/pdiff/pdiff.c @@ -286,6 +286,9 @@ pdiff_compare (cairo_surface_t *surface_a, w = cairo_image_surface_get_width (surface_a); h = cairo_image_surface_get_height (surface_a); + if (w < 3 || h < 3) /* too small for the Laplacian convolution */ + return -1; + for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { float r, g, b, l;