File gd-CVE-2016-10167.patch of Package gd.4119

Index: libgd-2.1.0/src/gd_gd2.c
===================================================================
--- libgd-2.1.0.orig/src/gd_gd2.c	2013-06-25 11:58:23.000000000 +0200
+++ libgd-2.1.0/src/gd_gd2.c	2017-02-01 13:41:54.236738149 +0100
@@ -376,18 +376,16 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFro
 
 						if (im->trueColor) {
 							if (!gdGetInt (&im->tpixels[y][x], in)) {
-								/*printf("EOF while reading\n"); */
-								/*gdImageDestroy(im); */
-								/*return 0; */
-								im->tpixels[y][x] = 0;
+								gd_error("gd2: EOF while reading\n");
+								gdImageDestroy(im);
+								return NULL;
 							}
 						} else {
 							int ch;
 							if (!gdGetByte (&ch, in)) {
-								/*printf("EOF while reading\n"); */
-								/*gdImageDestroy(im); */
-								/*return 0; */
-								ch = 0;
+								gd_error("gd2: EOF while reading\n");
+								gdImageDestroy(im);
+								return NULL;
 							}
 							im->pixels[y][x] = ch;
 						}