[glib] Fix the upper bound in g_unichar_iswide_bsearch



commit bcbd8d73cecdd2050670fab6502fab8c84d8cec5
Author: Iain Lane <iain orangesquash org uk>
Date:   Tue May 10 09:46:06 2016 +0100

    Fix the upper bound in g_unichar_iswide_bsearch
    
    asan noticed an array out of bound access in this function, which was
    because we were accessing G_N_ELEMENTS + 1.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766211

 glib/guniprop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/guniprop.c b/glib/guniprop.c
index 51725ec..9fc361b 100644
--- a/glib/guniprop.c
+++ b/glib/guniprop.c
@@ -439,7 +439,7 @@ static inline gboolean
 g_unichar_iswide_bsearch (gunichar ch)
 {
   int lower = 0;
-  int upper = G_N_ELEMENTS (g_unicode_width_table_wide) + 1;
+  int upper = G_N_ELEMENTS (g_unicode_width_table_wide) - 1;
   static int saved_mid = G_WIDTH_TABLE_MIDPOINT;
   int mid = saved_mid;
 


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