1. libgd
  2. Untitled project
  3. gd-libgd

Commits

tabe  committed 9370240

fixed FS#193

  • Participants
  • Parent commits 07c8336
  • Branches GD-2.0

Comments (0)

Files changed (1)

File src/gd_png.c

View file
  • Ignore whitespace
 				++colors;
 			}
 		}
+		if (colors == 0) {
+			fprintf(stderr, "gd-png error: no colors in palette\n");
+			goto bail;
+		}
 		if (colors < im->colorsTotal)
 		{
 			remap = TRUE;
 		}
 	}
 	/* 1.6.3: maybe we should give that memory BACK! TBB */
+ bail:
 	png_destroy_write_struct (&png_ptr, &info_ptr);
 }