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 792185 - PotentialMatch clamps array index to wrong upper bound
PotentialMatch clamps array index to wrong upper bound
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2018-01-03 22:34 UTC by Niels De Graef
Modified: 2018-01-04 11:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[Patch] Change the upper bound to the correct number. (1006 bytes, patch)
2018-01-03 22:34 UTC, Niels De Graef
committed Details | Review

Description Niels De Graef 2018-01-03 22:34:09 UTC
Created attachment 366265 [details] [review]
[Patch] Change the upper bound to the correct number.

As noted in bug 739997, GNOME Contacts has been experiencing crashes, which seem to stem from Folks.PotentialMatch. After some investigation, I found out that the `_contains`-method contains a wrong indexing logic. As noted in the commit message, the upper bound is wrongfully set to the length of the array (it should be the length - 1).

Attached is a patch which should fix the problem.

Assuming no other problems pop up by handling this, this would fix an annoying crash in GNOME Contacts for some people.
Comment 1 Philip Withnall 2018-01-03 23:19:03 UTC
Review of attachment 366265 [details] [review]:

Good fix, thanks a lot for the patch.
Comment 2 Niels De Graef 2018-01-03 23:21:06 UTC
Comment on attachment 366265 [details] [review]
[Patch] Change the upper bound to the correct number.

Landed on master as commit 765febf.
Comment 3 Philip Withnall 2018-01-03 23:30:00 UTC
Excellent, thanks. I’ll try and make a release in the next few weeks (so if you have any other bugs/fixes to get in, please let me know!).
Comment 4 Niels De Graef 2018-01-04 11:14:37 UTC
Thanks for the quick review!

At the moment, the only bugs I can think of that I would like to get in before the release are the ones I just posted (another indexing error and the display_name patch).