changeset 483:c9e3baeda1b1

Correctly escape data before using pango_layout_set_markup(). Exif data may contain characters like & or < >.
author zas_
date Tue, 22 Apr 2008 09:40:05 +0000
parents 75b7154e6435
children 35991929975d
files src/image-overlay.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/image-overlay.c	Tue Apr 22 09:01:29 2008 +0000
+++ b/src/image-overlay.c	Tue Apr 22 09:40:05 2008 +0000
@@ -204,7 +204,13 @@
 			g_free(data);
 			data = new_data;
 			}
-
+		if (data)
+			{
+			/* Since we use pango markup to display, we need to escape here */
+			gchar *escaped = g_markup_escape_text(data, -1);
+			g_free(data);
+			data = escaped;
+			}
 		g_string_erase(new, pos, end-start+1);
 		if (data)
 			g_string_insert(new, pos, data);
@@ -379,7 +385,6 @@
 			active_marks += fd->marks[mark];
 			}
 
-
 		if (active_marks > 0)
 			{
 			GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2);
@@ -400,10 +405,12 @@
 
     		if (with_hist)
 			{
+			gchar *escaped_histogram_label = g_markup_escape_text(histogram_label(imd->histogram), -1);
 			if (*text)
-				text2 = g_strdup_printf("%s\n%s", text, histogram_label(imd->histogram));
+				text2 = g_strdup_printf("%s\n%s", text, escaped_histogram_label);
 			else
-				text2 = g_strdup(histogram_label(imd->histogram));
+				text2 = g_strdup(escaped_histogram_label);
+			g_free(escaped_histogram_label);
 			g_free(text);
 			text = text2;
 			}