[gnome-color-manager] Ensure the GcmProfile text descriptions are displayable to avoid critical warnings on corrupt ICC pr



commit ae4a9130705123a3e4e4c9c6ba8115dbb91f2245
Author: Richard Hughes <richard hughsie com>
Date:   Thu Nov 12 08:52:00 2009 +0000

    Ensure the GcmProfile text descriptions are displayable to avoid critical warnings on corrupt ICC profiles

 src/gcm-profile.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 6ba5193..5b854e9 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -492,6 +492,23 @@ gcm_parser_load_icc_trc (GcmProfile *profile, const gchar *data, gsize offset, g
 }
 
 /**
+ * gcm_profile_ensure_printable:
+ **/
+static void
+gcm_profile_ensure_printable (gchar *data)
+{
+	guint i;
+	guint idx = 0;
+	for (i=0; data[i] != '\0'; i++) {
+		if (g_ascii_isalnum (data[i]) ||
+		    g_ascii_ispunct (data[i]) ||
+		    data[i] == ' ')
+			data[idx++] = data[i];
+	}
+	data[idx] = '\0';
+}
+
+/**
  * gcm_profile_parse_data:
  **/
 gboolean
@@ -647,6 +664,11 @@ gcm_profile_parse_data (GcmProfile *profile, const gchar *data, gsize length, GE
 		}
 	}
 
+	/* Ensure this is displayable */
+	gcm_profile_ensure_printable (priv->description);
+	gcm_profile_ensure_printable (priv->copyright);
+	gcm_profile_ensure_printable (priv->vendor);
+
 	/* success */
 	ret = TRUE;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]