From: Lutz M?l. <lu...@us...> - 2003-07-29 22:19:43
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv25869/libexif Modified Files: exif-entry.c Log Message: 2003-07-30 Lutz Mueller <lu...@us...> * libexif/exif-entry.c: Don't crash if entries are totally insane. Index: exif-entry.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-entry.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- exif-entry.c 30 Apr 2003 23:51:44 -0000 1.35 +++ exif-entry.c 29 Jul 2003 22:19:40 -0000 1.36 @@ -165,6 +165,14 @@ memset (v, 0, sizeof (v)); memset (b, 0, sizeof (b)); + /* Sanity check */ + if (e->size != e->components * exif_format_get_size (e->format)) { + snprintf (v, sizeof (v), _("Invalid size of entry (%i, " + "expected %li x %i)."), e->size, e->components, + exif_format_get_size (e->format)); + return v; + } + switch (e->tag) { case EXIF_TAG_USER_COMMENT: CF (e->format, EXIF_FORMAT_UNDEFINED, v); @@ -884,6 +892,7 @@ e->components); } default: + if (!e->components) break; switch (e->format) { case EXIF_FORMAT_UNDEFINED: break; |