Update of /cvsroot/libexif/libexif/libexif/canon
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25655/libexif/canon
Modified Files:
exif-mnote-data-canon.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-canon.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/canon/exif-mnote-data-canon.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -p -d -r1.16 -r1.17
--- exif-mnote-data-canon.c 14 Feb 2008 19:20:22 -0000 1.16
+++ exif-mnote-data-canon.c 16 Feb 2008 19:11:40 -0000 1.17
@@ -120,6 +120,7 @@ exif_mnote_data_canon_save (ExifMnoteDat
ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne;
unsigned int i, o, s, doff;
unsigned char *t;
+ unsigned int ts;
if (!n || !buf || !buf_size) return;
@@ -145,14 +146,15 @@ exif_mnote_data_canon_save (ExifMnoteDat
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;
+ if (s & 1) ts += 1;
t = exif_mem_realloc (ne->mem, *buf,
- sizeof (char) * *buf_size);
+ sizeof (char) * ts);
if (!t) 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, n->offset + doff);
@@ -201,10 +203,10 @@ exif_mnote_data_canon_load (ExifMnoteDat
o = 6 + 2 + n->offset + 12 * i;
if (o + 8 > buf_size) return;
- n->count = i + 1;
t = exif_mem_realloc (ne->mem, n->entries,
sizeof (MnoteCanonEntry) * (i + 1));
if (!t) return;
+ n->count = i + 1;
n->entries = t;
memset (&n->entries[i], 0, sizeof (MnoteCanonEntry));
n->entries[i].tag = exif_get_short (buf + o, n->order);
|