Better handling of very small input file when reading SVG image file.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12945 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2018-06-18 12:48:34 +00:00
parent 35f5b97aa4
commit 5e45b7d4fe
1 changed files with 3 additions and 2 deletions

View File

@ -82,8 +82,9 @@ static char *svg_inflate(const char *fname) {
FILE *in = fl_fopen(fname, "r");
if (!in) return NULL;
unsigned char header[2];
if (fread(header, 2, 1, in) < 1) { // FIXME: can't read file header
header[0] = header[1] = 0; // FIXME: continuing anyway ?
if (fread(header, 2, 1, in) < 1) {
fclose(in);
return NULL;
}
int direct = (header[0] != 0x1f || header[1] != 0x8b);
fseek(in, 0, SEEK_END);