Update of /cvsroot/libexif/libexif/libexif
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2627/libexif
Modified Files:
exif-content.c exif-data.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-data.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -p -d -r1.107 -r1.108
--- exif-data.c 10 Feb 2008 06:12:54 -0000 1.107
+++ exif-data.c 14 Feb 2008 19:20:21 -0000 1.108
@@ -233,6 +233,7 @@ exif_data_save_data_entry (ExifData *dat
unsigned int offset)
{
unsigned int doff, s;
+ unsigned char *t;
if (!data || !data->priv)
return;
@@ -277,11 +278,12 @@ exif_data_save_data_entry (ExifData *dat
*/
if (s & 1)
(*ds)++;
- *d = exif_mem_realloc (data->priv->mem, *d, *ds);
- if (!*d) {
+ t = exif_mem_realloc (data->priv->mem, *d, *ds);
+ if (!t) {
EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", *ds);
return;
}
+ *d = t;
exif_set_long (*d + 6 + offset + 8, data->priv->order, doff);
if (s & 1)
*(*d + *ds - 1) = '\0';
@@ -476,6 +478,7 @@ exif_data_save_data_content (ExifData *d
{
unsigned int j, n_ptr = 0, n_thumb = 0;
ExifIfd i;
+ unsigned char *t;
if (!data || !data->priv || !ifd || !d || !ds)
return;
@@ -521,11 +524,12 @@ exif_data_save_data_content (ExifData *d
* and the number of entries.
*/
*ds += (2 + (ifd->count + n_ptr + n_thumb) * 12 + 4);
- *d = exif_mem_realloc (data->priv->mem, *d, *ds);
- if (!*d) {
+ t = exif_mem_realloc (data->priv->mem, *d, *ds);
+ if (!t) {
EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", *ds);
return;
}
+ *d = t;
/* Save the number of entries */
exif_set_short (*d + 6 + offset, data->priv->order,
@@ -625,12 +629,13 @@ exif_data_save_data_content (ExifData *d
exif_set_long (*d + 6 + offset + 8, data->priv->order,
*ds - 6);
*ds += data->size;
- *d = exif_mem_realloc (data->priv->mem, *d, *ds);
- if (!*d) {
+ t = exif_mem_realloc (data->priv->mem, *d, *ds);
+ if (!t) {
EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData",
*ds);
return;
}
+ *d = t;
memcpy (*d + *ds - data->size, data->data, data->size);
offset += 12;
Index: exif-content.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/exif-content.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -p -d -r1.22 -r1.23
--- exif-content.c 30 Oct 2007 04:15:15 -0000 1.22
+++ exif-content.c 14 Feb 2008 19:20:21 -0000 1.23
@@ -157,6 +157,7 @@ void
exif_content_remove_entry (ExifContent *c, ExifEntry *e)
{
unsigned int i;
+ ExifEntry **t;
if (!c || !c->priv || !e || (e->parent != c)) return;
@@ -170,8 +171,9 @@ exif_content_remove_entry (ExifContent *
c->count--;
e->parent = NULL;
exif_entry_unref (e);
- c->entries = exif_mem_realloc (c->priv->mem, c->entries,
+ t = exif_mem_realloc (c->priv->mem, c->entries,
sizeof(ExifEntry*) * c->count);
+ if (t) c->entries = t;
}
ExifEntry *
|