[gtk/matthiasc/for-master: 2/2] emojicompletion: Avoid a memory overrun




commit b69e34a3259d422ed824c5c9eb4fe2d2d606af21
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 15 15:16:06 2020 -0400

    emojicompletion: Avoid a memory overrun
    
    Don't read beyond the beginning of the string.
    
    Fixes: #3245

 gtk/gtkemojicompletion.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkemojicompletion.c b/gtk/gtkemojicompletion.c
index 712418850a..31669c85d5 100644
--- a/gtk/gtkemojicompletion.c
+++ b/gtk/gtkemojicompletion.c
@@ -115,7 +115,8 @@ next:
               break;
             }
         }
-      while (g_unichar_isalnum (g_utf8_get_char (p)) || *p == '_' || *p == ' ');
+      while (p > text &&
+             (g_unichar_isalnum (g_utf8_get_char (p)) || *p == '_' || *p == ' '));
 
       if (found_candidate)
         n_matches = populate_completion (completion, p, 0);


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