|
|
@ -157,7 +157,7 @@ read_func(png_structp png, png_bytep data, png_size_t size) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FILE *fp = png_get_io_ptr(png); |
|
|
|
FILE *fp = png_get_io_ptr(png); |
|
|
|
|
|
|
|
|
|
|
|
if (fread(data, 1, size, fp) < 0) |
|
|
|
if (fread(data, 1, size, fp) != size) |
|
|
|
png_error(png, NULL); |
|
|
|
png_error(png, NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -356,7 +356,9 @@ load_image(const char *filename) |
|
|
|
if (fp == NULL) |
|
|
|
if (fp == NULL) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
fread(header, sizeof header, 1, fp); |
|
|
|
if (fread(header, sizeof header, 1, fp) != 1) |
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
rewind(fp); |
|
|
|
rewind(fp); |
|
|
|
for (i = 0; i < ARRAY_LENGTH(loaders); i++) { |
|
|
|
for (i = 0; i < ARRAY_LENGTH(loaders); i++) { |
|
|
|
if (memcmp(header, loaders[i].header, |
|
|
|
if (memcmp(header, loaders[i].header, |
|
|
|