[gimp] Bug 765411: CRITICAL warnings loading an xcf with...
- From: Massimo Valentini <mvalentini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 765411: CRITICAL warnings loading an xcf with...
- Date: Fri, 22 Apr 2016 16:43:17 +0000 (UTC)
commit a3f4c50b3e9fb346d1b903d1d67417d1244e8f95
Author: Massimo Valentini <mvalentini src gnome org>
Date: Fri Apr 22 17:15:23 2016 +0200
Bug 765411: CRITICAL warnings loading an xcf with...
"exif-data" parasite
To migrate old "exif-data" parasites to GimpMetadata
an exif-only jpeg file is generated in memory, but its
APP1 marker length was 2 bytes short resulting in a
CRITICAL warning:
** (gimp-2.9:9): CRITICAL **: Directory Photo: IFD exceeds data buffer, cannot read next pointer.
Properly terminating the jpeg with an EOI marker also
gets rid of the WARNING:
** (gimp-2.9:9): WARNING **: JPEG format error, rc = 5
libgimpbase/gimpmetadata.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libgimpbase/gimpmetadata.c b/libgimpbase/gimpmetadata.c
index 39d2d97..14e8273 100644
--- a/libgimpbase/gimpmetadata.c
+++ b/libgimpbase/gimpmetadata.c
@@ -622,15 +622,16 @@ gimp_metadata_set_from_exif (GimpMetadata *metadata,
GByteArray *exif_bytes;
GimpMetadata *exif_metadata;
guint8 data_size[2] = { 0, };
+ const guint8 eoi[2] = { 0xff, 0xd9 };
g_return_val_if_fail (GEXIV2_IS_METADATA (metadata), FALSE);
g_return_val_if_fail (exif_data != NULL, FALSE);
g_return_val_if_fail (exif_data_length > 0, FALSE);
- g_return_val_if_fail (exif_data_length < 65536, FALSE);
+ g_return_val_if_fail (exif_data_length + 2 < 65536, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- data_size[0] = (exif_data_length & 0xFF00) >> 8;
- data_size[1] = (exif_data_length & 0x00FF);
+ data_size[0] = ((exif_data_length + 2) & 0xFF00) >> 8;
+ data_size[1] = ((exif_data_length + 2) & 0x00FF);
exif_bytes = g_byte_array_new ();
exif_bytes = g_byte_array_append (exif_bytes,
@@ -639,6 +640,7 @@ gimp_metadata_set_from_exif (GimpMetadata *metadata,
data_size, 2);
exif_bytes = g_byte_array_append (exif_bytes,
(guint8 *) exif_data, exif_data_length);
+ exif_bytes = g_byte_array_append (exif_bytes, eoi, 2);
exif_metadata = gimp_metadata_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]