[tracker] libtracker-extract: Ignore keywords containing invalid UTF-8



commit eb452d79911e50967d0cb5fb283e26e80e37579a
Author: JÃrg Billeter <j bitron ch>
Date:   Thu Jun 30 14:40:34 2011 +0200

    libtracker-extract: Ignore keywords containing invalid UTF-8
    
    Fixes NB#269931.

 src/libtracker-extract/tracker-utils.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-utils.c b/src/libtracker-extract/tracker-utils.c
index 887adac..dfed218 100644
--- a/src/libtracker-extract/tracker-utils.c
+++ b/src/libtracker-extract/tracker-utils.c
@@ -1015,6 +1015,12 @@ tracker_keywords_parse (GPtrArray   *store,
 		if (p_dup[len-1] == ' ')
 			p_dup[len-1] = '\0';
 
+		/* ignore keywords containing invalid UTF-8 */
+		if (!g_utf8_validate (p_dup, -1, NULL)) {
+			g_free (p_do);
+			continue;
+		}
+
 		for (i = 0; i < store->len; i++) {
 			const gchar *earlier = g_ptr_array_index (store, i);
 			if (g_strcmp0 (earlier, p_dup) == 0) {



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