summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2010-05-24 23:27:39 (GMT)
committerRasmus Lerdorf <rasmus@php.net>2010-05-24 23:27:39 (GMT)
commit13a09194a9a1340f79eea63c5ffe9b3f12b767d2 (patch)
treedfbb434c1ea20b62b1f40f4f60ec3d187a228c71 /ext
parent45a2014ce13f65c2dae95697db06678bb2144aa3 (diff)
downloadphp-13a09194a9a1340f79eea63c5ffe9b3f12b767d2.tar.gz
Let's have a sane error message here instead of some cryptic zlib error
Diffstat (limited to 'ext')
-rw-r--r--ext/gd/libgd/gd_png.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c
index 52a087e..1af4930 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);