Commits

Ondřej Surý  committed 17ce9be

Fail on unknown PNG color_type instead of using initialized memory blocks (num_colors)

  • Participants
  • Parent commits 3b38b47

Comments (0)

Files changed (1)

File src/gd_png.c

 			}
 		}
 		break;
+	default:
+		gd_error("gd-png color_type is unknown: %d\n", color_type);
+		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+		gdFree(image_data);
+		gdFree(row_pointers);
+		if (im) {
+			gdImageDestroy(im);
+		}
+		return NULL;
+		break;
 	}
 
 	png_read_update_info (png_ptr, info_ptr);