fix unknown buffer content chekc problems

SVN revision: 32185
This commit is contained in:
Carsten Haitzler 2007-10-28 10:08:32 +00:00
parent cd2e7767fd
commit 90b9f41ec5
3 changed files with 16 additions and 3 deletions

View File

@ -39,7 +39,11 @@ evas_image_load_file_head_png(RGBA_Image *im, const char *file, const char *key)
if (!f) return 0;
/* if we havent read the header before, set the header data */
fread(buf, 1, PNG_BYTES_TO_CHECK, f);
if (fread(buf, 1, PNG_BYTES_TO_CHECK, f) != 1)
{
fclose(f);
return 0;
}
if (!png_check_sig(buf, PNG_BYTES_TO_CHECK))
{
fclose(f);

View File

@ -126,7 +126,11 @@ evas_image_load_file_head_tiff(RGBA_Image *im, const char *file, const char *key
if (!ffile)
return 0;
fread(&magic_number, sizeof(uint16), 1, ffile);
if (fread(&magic_number, sizeof(uint16), 1, ffile) != 1)
{
fclose(ffile);
return 0;
}
/* Apparently rewind(f) isn't sufficient */
fseek(ffile, (long)0, SEEK_SET);

View File

@ -128,7 +128,12 @@ evas_image_load_file_xpm(RGBA_Image *im, const char *file, const char *key, int
xpm_parse_done();
return 0;
}
fread(s, 1, 9, f);
if (fread(s, 9, 1, f) != 1)
{
fclose(f);
xpm_parse_done();
return 0;
}
rewind(f);
s[9] = 0;
if (strcmp("/* XPM */", s))