From: Lutz M. <lu...@us...> - 2008-02-14 19:21:02
|
Update of /cvsroot/libexif/libexif/libexif/canon In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2627/libexif/canon Modified Files: exif-mnote-data-canon.c Log Message: 2008-02-14 Lutz Mueller <lu...@us...> Fix #1774591 (partially): * libexif/exif-content.c: (exif_content_remove_entry) Check the return value of exif_mem_realloc. * libexif/exif-data.c: (exif_data_save_data_entry), (exif_data_save_data_content) Same here. * libexif/canon/exif-mnote-data-canon.c: (exif_mnote_data_canon_save), (exif_mnote_data_canon_load) Same here. * libexif/fuji/exif-mnote-data-fuji.c: (exif_mnote_data_fuji_save), (exif_mnote_data_fuji_load) Same here. * libexif/olympus/exif-mnote-data-olympus.c: (exif_mnote_data_olympus_save) Same here. Index: exif-mnote-data-canon.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/exif-mnote-data-canon.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -p -d -r1.15 -r1.16 --- exif-mnote-data-canon.c 9 May 2007 06:15:23 -0000 1.15 +++ exif-mnote-data-canon.c 14 Feb 2008 19:20:22 -0000 1.16 @@ -119,6 +119,7 @@ exif_mnote_data_canon_save (ExifMnoteDat { ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne; unsigned int i, o, s, doff; + unsigned char *t; if (!n || !buf || !buf_size) return; @@ -148,9 +149,10 @@ exif_mnote_data_canon_save (ExifMnoteDat /* Ensure even offsets. Set padding bytes to 0. */ if (s & 1) *buf_size += 1; - *buf = exif_mem_realloc (ne->mem, *buf, + t = exif_mem_realloc (ne->mem, *buf, sizeof (char) * *buf_size); - if (!*buf) return; + if (!t) return; + *buf = t; doff = *buf_size - s; if (s & 1) { doff--; *(*buf + *buf_size - 1) = '\0'; } exif_set_long (*buf + o, n->order, n->offset + doff); @@ -186,6 +188,7 @@ exif_mnote_data_canon_load (ExifMnoteDat ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne; ExifShort c; unsigned int i, o, s; + MnoteCanonEntry *t; if (!n || !buf || !buf_size || (buf_size < 6 + n->offset + 2)) return; @@ -199,8 +202,10 @@ exif_mnote_data_canon_load (ExifMnoteDat if (o + 8 > buf_size) return; n->count = i + 1; - n->entries = exif_mem_realloc (ne->mem, n->entries, - sizeof (MnoteCanonEntry) * (i+1)); + t = exif_mem_realloc (ne->mem, n->entries, + sizeof (MnoteCanonEntry) * (i + 1)); + if (!t) return; + n->entries = t; memset (&n->entries[i], 0, sizeof (MnoteCanonEntry)); n->entries[i].tag = exif_get_short (buf + o, n->order); n->entries[i].format = exif_get_short (buf + o + 2, n->order); |