[gspell/wip/misc] InlineCheckerTextBuffer: make check_subregion() more robust



commit 7844df558c7e6e7a919a55f73462e8f440963f94
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Aug 19 12:43:09 2017 +0200

    InlineCheckerTextBuffer: make check_subregion() more robust
    
    Timm Bäder has sometimes this with valgrind:
    
     113 ==15797== Conditional jump or move depends on uninitialised value(s)
     114 ==15797==    at 0x5F1E766: g_utf8_find_next_char (gutf8.c:185)
     115 ==15797==    by 0x81855F7: check_subregion (gspell-inline-checker-text-buffer.c:345)
     116 ==15797==    by 0x8185C7B: check_visible_region_in_view (gspell-inline-checker-text-buffer.c:499)
     117 ==15797==    by 0x818601D: check_visible_region (gspell-inline-checker-text-buffer.c:567)
     118 ==15797==    by 0x818604A: timeout_cb (gspell-inline-checker-text-buffer.c:574)
     119 ==15797==    by 0x5F638F2: g_timeout_dispatch.lto_priv.218 (gmain.c:4633)
     120 ==15797==    by 0x5F619BB: g_main_dispatch (gmain.c:3148)
     121 ==15797==    by 0x5F6291C: g_main_context_dispatch (gmain.c:3813)
     122 ==15797==    by 0x5F62B0F: g_main_context_iterate (gmain.c:3886)
     123 ==15797==    by 0x5F62BE7: g_main_context_iteration (gmain.c:3947)
     124 ==15797==    by 0x55FC55A: g_application_run (gapplication.c:2401)
     125 ==15797==    by 0x108A99: _vala_main (main.vala:26)
     126 ==15797==    by 0x108AE2: main (main.vala:18)

 gspell/gspell-inline-checker-text-buffer.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index 410678b..7abbd23 100644
--- a/gspell/gspell-inline-checker-text-buffer.c
+++ b/gspell/gspell-inline-checker-text-buffer.c
@@ -248,6 +248,12 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
 
        text = gtk_text_iter_get_slice (start, end);
 
+       if (text == NULL || text[0] == '\0')
+       {
+               g_free (text);
+               return;
+       }
+
        get_pango_log_attrs (text, &attrs, &n_attrs);
 
        attr_num = 0;


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