After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782510 - cuisine-page: Fix using possible invalid index
cuisine-page: Fix using possible invalid index
Status: RESOLVED FIXED
Product: recipes
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Recipes maintainer(s)
Recipes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-05-11 10:36 UTC by Mohammed Sadiq
Modified: 2017-05-11 14:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
cuisine-page: Fix using possible invalid index (1.36 KB, patch)
2017-05-11 10:36 UTC, Mohammed Sadiq
committed Details | Review

Description Mohammed Sadiq 2017-05-11 10:36:28 UTC
.
Comment 1 Mohammed Sadiq 2017-05-11 10:36:36 UTC
Created attachment 351614 [details] [review]
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
Comment 2 Matthias Clasen 2017-05-11 14:28:25 UTC
Attachment 351614 [details] pushed as 3d0d800 - cuisine-page: Fix using possible invalid index