From: Lutz M. <lu...@us...> - 2008-02-16 19:11:48
|
Update of /cvsroot/libexif/libexif/libexif/fuji In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25655/libexif/fuji Modified Files: exif-mnote-data-fuji.c Log Message: 2008-02-16 Lutz Mueller <lu...@us...> Jan Patera <pa...@pi...> spotted a problem with my last fix for #1774591: * libexif/exif-content.c: (exif_content_remove_entry) Recover correctly in case of error by remembering the original size of the realloc'ed data. * 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-fuji.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/fuji/exif-mnote-data-fuji.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- exif-mnote-data-fuji.c 14 Feb 2008 19:20:22 -0000 1.2 +++ exif-mnote-data-fuji.c 16 Feb 2008 19:11:40 -0000 1.3 @@ -80,6 +80,7 @@ exif_mnote_data_fuji_save (ExifMnoteData ExifMnoteDataFuji *n = (ExifMnoteDataFuji *) ne; unsigned int i, o, s, doff; unsigned char *t; + unsigned int ts; if (!n || !buf || !buf_size) return; @@ -114,16 +115,17 @@ exif_mnote_data_fuji_save (ExifMnoteData s = exif_format_get_size (n->entries[i].format) * n->entries[i].components; if (s > 4) { - *buf_size += s; + ts = *buf_size + s; /* Ensure even offsets. Set padding bytes to 0. */ - if (s & 1) *buf_size += 1; - t = exif_mem_realloc (ne->mem, *buf, *buf_size); + if (s & 1) ts += 1; + t = exif_mem_realloc (ne->mem, *buf, ts); if (!t) { *buf_size = 0; return; } *buf = t; + *buf_size = ts; doff = *buf_size - s; if (s & 1) { doff--; *(*buf + *buf_size - 1) = '\0'; } exif_set_long (*buf + o, n->order, doff); @@ -162,10 +164,10 @@ exif_mnote_data_fuji_load (ExifMnoteData o = datao + 12 * i; if (datao + 12 > buf_size) return; - n->count = i + 1; t = exif_mem_realloc (en->mem, n->entries, sizeof (MnoteFujiEntry) * (i + 1)); if (!t) return; + n->count = i + 1; n->entries = t; memset (&n->entries[i], 0, sizeof (MnoteFujiEntry)); n->entries[i].tag = exif_get_short (buf + o, n->order); |