[recipes] cuisine-page: Fix using possible invalid index



commit 3d0d80070490d882289eae93bc35551170ba413a
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Thu May 11 16:05:43 2017 +0530

    cuisine-page: Fix using possible invalid index
    
    If the loop preceding didn't break, the value of index `i' would be
    `self->n_categories'. As this would be out of the array boundary,
    a segmentation fault was happening here.
    
    This was found by -fsanitize=address:
    
    ==4919==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x614000027df0 at
    pc 0x55f314f2ff1c bp 0x7ffe34e80db0 sp 0x7ffe34e80da8
    WRITE of size 4 at 0x614000027df0 thread T0
        #0 0x55f314f2ff1b in gr_cuisine_page_set_cuisine ../src/gr-cuisine-page.c:282
        #1 0x55f314faaaba in gr_window_show_cuisine ../src/gr-window.c:1376
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782510

 src/gr-cuisine-page.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-cuisine-page.c b/src/gr-cuisine-page.c
index 034a5cd..ca9ae57 100644
--- a/src/gr-cuisine-page.c
+++ b/src/gr-cuisine-page.c
@@ -278,7 +278,7 @@ gr_cuisine_page_set_cuisine (GrCuisinePage *self,
 
                 gtk_widget_show (c->label);
                 gtk_widget_show (c->box);
-                self->categories[i].filled = TRUE;
+                c->filled = TRUE;
 
                 tile = gr_recipe_tile_new (recipe);
                 gtk_widget_show (tile);


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