1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-31 13:05:52 +01:00

fix for 0 sized images

This commit is contained in:
kojima
2002-10-25 03:43:57 +00:00
parent 55efa1f268
commit 0f0afc48ab
4 changed files with 16 additions and 2 deletions

View File

@@ -112,6 +112,15 @@ RLoadPNG(RContext *context, char *file, int index)
png_get_IHDR(png, pinfo, &width, &height, &depth, &color_type,
&junk, &junk, &junk);
/* sanity check */
if (width < 1 || height < 1) {
fclose(f);
png_destroy_read_struct(&png, &pinfo, &einfo);
RErrorCode = RERR_BADIMAGEFILE;
return NULL;
}
/* check for an alpha channel */
if (png_get_valid(png, pinfo, PNG_INFO_tRNS))