From 159369c68cfd942412521b27b54be270f0710f70 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Mon, 24 May 2010 23:27:39 +0000 Subject: [PATCH] Let's have a sane error message here instead of some cryptic zlib error --- ext/gd/libgd/gd_png.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c index 52a087e787..1af49308c5 100644 --- a/ext/gd/libgd/gd_png.c +++ b/ext/gd/libgd/gd_png.c @@ -515,6 +515,10 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level, int basefilte /* png_set_filter(png_ptr, 0, PNG_FILTER_NONE); */ /* 2.0.12: this is finally a parameter */ + if (level < 0 || level > 9) { + php_gd_error("gd-png error: compression level must be between 0 and 9"); + return; + } png_set_compression_level(png_ptr, level); if (basefilter >= 0) { png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, basefilter); -- 2.40.0