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 667225 - GSocket: add missing type checks to public methods
GSocket: add missing type checks to public methods
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-01-03 22:17 UTC by Claudio Saavedra
Modified: 2012-01-04 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GSocket: add missing type checks to public methods (1.78 KB, patch)
2012-01-03 22:17 UTC, Claudio Saavedra
committed Details | Review

Description Claudio Saavedra 2012-01-03 22:17:24 UTC
Although passing NULL as a socket can be considered a user error,
gio shouldn't crash and check_socket() will certainly do if NULL
is passed. Safeguard against this.
Comment 1 Claudio Saavedra 2012-01-03 22:17:26 UTC
Created attachment 204533 [details] [review]
GSocket: add missing type checks to public methods
Comment 2 Dan Winship 2012-01-04 15:33:31 UTC
Comment on attachment 204533 [details] [review]
GSocket: add missing type checks to public methods

>Although passing NULL as a socket can be considered a user error,
>gio shouldn't crash and check_socket() will certainly do if NULL
>is passed. Safeguard against this.

The patch is fine, but the commit message is wrong. It *is* an error, not just "can be considered" one, and gio will still crash if you pass it a NULL even with this patch if you built it with G_DISABLE_CHECKS. I'd just say something like "GSocket: add some more g_return_if_fail()s"
Comment 3 Claudio Saavedra 2012-01-04 16:17:08 UTC
Pushed after fixing the commit message as suggested.