[evince] ev-find-sidebar: fix a crash due to an infinite loop resolving hyphenations



commit 4a8ccb4234e8f20232852f59a16dd5309a86d092
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Jun 30 09:30:02 2013 +0200

    ev-find-sidebar: fix a crash due to an infinite loop resolving hyphenations
    
    Do not try to resolve the hyphenation if the hyphen is the last
    character of the chunk processed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703275

 shell/ev-find-sidebar.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/shell/ev-find-sidebar.c b/shell/ev-find-sidebar.c
index 221ab06..1d03b94 100644
--- a/shell/ev-find-sidebar.c
+++ b/shell/ev-find-sidebar.c
@@ -226,15 +226,18 @@ sanitized_substring (const gchar  *text,
         p = start_ptr;
 
         while (p != end_ptr) {
-                const gchar      *next;
-                GUnicodeBreakType break_type;
+                const gchar *next;
 
                 next = g_utf8_next_char (p);
 
-                break_type = g_unichar_break_type (g_utf8_get_char (p));
-                if (break_type == G_UNICODE_BREAK_HYPHEN && *next == '\n') {
-                        p = g_utf8_next_char (next);
-                        continue;
+                if (next != end_ptr) {
+                        GUnicodeBreakType break_type;
+
+                        break_type = g_unichar_break_type (g_utf8_get_char (p));
+                        if (break_type == G_UNICODE_BREAK_HYPHEN && *next == '\n') {
+                                p = g_utf8_next_char (next);
+                                continue;
+                        }
                 }
 
                 if (*p != '\n') {


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