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 731339 - giochannel: avoid setting uninitialised length
giochannel: avoid setting uninitialised length
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-06-06 16:19 UTC by Allison Karlitskaya (desrt)
Modified: 2014-06-28 17:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
giochannel: avoid setting uninitialised length (1.31 KB, patch)
2014-06-06 16:19 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2014-06-06 16:19:28 UTC
Our internal call to g_io_channel_read_line_backend() may return
G_IO_STATUS_ERROR, in which case two things will be true:

 - the GError will have been set (if appropriate)

 - the &got_length return value may not have been set

Since it's our convention to leave 'out' parameters untouched in
exception cases, this is perfectly fine.  Unfortunately,
g_io_channel_read_line(), in wrapping this internal function, always
promotes the length parameter, even in the case of error.

Stop doing that in order to avoid overwriting the callers's variable
with junk in the error case.
Comment 1 Allison Karlitskaya (desrt) 2014-06-06 16:19:30 UTC
Created attachment 278047 [details] [review]
giochannel: avoid setting uninitialised length
Comment 2 Lars Karlitski 2014-06-07 07:37:36 UTC
Review of attachment 278047 [details] [review]:

Looks good.
Comment 3 Matthias Clasen 2014-06-28 17:53:11 UTC
Attachment 278047 [details] pushed as 0007376 - giochannel: avoid setting uninitialised length