Commits

Anonymous committed bc5cb9d

fix FS#235

Comments (0)

Files changed (1)

   volatile int remap = FALSE;
 #ifdef PNG_SETJMP_SUPPORTED
   jmpbuf_wrapper jbw;
+#endif
+
+  /* width or height of value 0 is invalid in IHDR;
+	 see http://www.w3.org/TR/PNG-Chunks.html */
+  if (width == 0 || height ==0) return;
 
+#ifdef PNG_SETJMP_SUPPORTED
   png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING,
 				     &jbw, gdPngErrorHandler,
 				     NULL);