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 710002 - G_MAXUINT may be assigned as duplicate source id
G_MAXUINT may be assigned as duplicate source id
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: mainloop
2.37.x
Other All
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-10-12 18:07 UTC by Noah Massey
Modified: 2013-10-13 14:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add id to used_source_ids (908 bytes, patch)
2013-10-12 18:07 UTC, Noah Massey
committed Details | Review

Description Noah Massey 2013-10-12 18:07:26 UTC
Created attachment 257113 [details] [review]
Patch to add id to used_source_ids

When the source id overflows, source id assigning switches from a standard increment to randomly assigned, with a check to ensure the random source id is not currently in use.

The source which triggers the overflow is assigned G_MAXUINT, but not until after the assigned source ids are cached.

This leads to the remote possibility that a second source can be assigned G_MAXUINT as its source id while the original source is still active.
Comment 1 Colin Walters 2013-10-12 20:33:07 UTC
Review of attachment 257113 [details] [review]:

Hi Noah,

Thank you very much, this patch looks correct to me.  Out of curiosity did you hit this in practice or did you just notice this via code inspection?

You seem to have submitted a patch without an email address; did you have a concern about your email appearing in the git log?  Or is it OK if I apply this patch and credit you?
Comment 2 Noah Massey 2013-10-12 23:48:36 UTC
Colin,

I just noticed it in code. I was checking to see if I wanted to hold the id or source ref on a local timeout source.

The patch got created with a different email account, so I just removed it. I'm fine with being credited. :)

Best,
Noah