[gimp/gimp-attributes-wip: 101/102] libgimpbase: check for length of unusual attribute value. If it is longer than 2048 bytes, the inter
- From: Hartmut Kuhse <hartmutkuhse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-attributes-wip: 101/102] libgimpbase: check for length of unusual attribute value. If it is longer than 2048 bytes, the inter
- Date: Thu, 31 Mar 2016 16:00:01 +0000 (UTC)
commit e01e826c99d046e11726db57112fb73869e54e66
Author: Hartmut Kuhse <hk_priv gmx de>
Date: Thu Mar 31 17:57:02 2016 +0200
libgimpbase: check for length of unusual attribute value.
If it is longer than 2048 bytes, the interpreted_value
is set to the length of value.
Those very long values may exist in some makernotes,
as in Exif.Pentax or Exif.PentaxDNG
libgimpbase/gimpattributes.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/libgimpbase/gimpattributes.c b/libgimpbase/gimpattributes.c
index 2aa2ee4..5329391 100644
--- a/libgimpbase/gimpattributes.c
+++ b/libgimpbase/gimpattributes.c
@@ -760,15 +760,29 @@ gimp_attributes_from_metadata (GimpAttributes *attributes, GimpMetadata *metadat
interpreted = g_strcmp0 (value, interpreted_value);
+ if (!interpreted)
+ {
+ gint length;
+
+ length = strlen (interpreted_value);
+ if (length > 2048)
+ {
+ g_free (interpreted_value);
+ interpreted_value = g_strdup_printf ("(Size of value: %d)", length);
+ interpreted = TRUE;
+ }
+ }
+
attribute = gimp_attribute_new_string (exif_data[i], value, attrib_type);
if (gimp_attribute_is_valid (attribute))
{
if (no_interpreted)
{
if (interpreted)
- gimp_attribute_set_interpreted_string (attribute, interpreted_value);
+ {
+ gimp_attribute_set_interpreted_string (attribute, interpreted_value);
+ }
}
-
gimp_attributes_add_attribute (new_attributes, attribute);
}
else
@@ -853,7 +867,6 @@ gimp_attributes_from_metadata (GimpAttributes *attributes, GimpMetadata *metadat
g_strfreev (iptc_data);
}
-
return new_attributes;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]