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 616043 - Set all out arguments to a known bad pointer and check for it
Set all out arguments to a known bad pointer and check for it
Status: RESOLVED FIXED
Product: pygi
Classification: Deprecated
Component: general
unspecified
Other Linux
: Normal normal
: 0.6
Assigned To: pygi-maint
pygi-maint
Depends on:
Blocks:
 
 
Reported: 2010-04-17 18:59 UTC by Zach Goldberg
Modified: 2010-04-26 16:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Force out arguments to be initialized as NULL. Comes with a test. (1.72 KB, patch)
2010-04-21 03:56 UTC, Zach Goldberg
committed Details | Review

Description Zach Goldberg 2010-04-17 18:59:45 UTC
PyGI should set all out arguments by default to some known value, such as the address of _wrap_g_info_function_invoke_, and then before we do something like try and free the out arguments we check to make sure they are not NULL and not that address.  This is to protect against library bugs where they leave out arguments dangling instead of setting them to NULL.
Comment 1 Zach Goldberg 2010-04-20 16:07:19 UTC
Any complaints if I just do 

 *out_var = NULL;  

and then check for NULL later?  I'm thinking about this more now and I don't see any reason why we need a specific address/
Comment 2 Zach Goldberg 2010-04-21 03:56:03 UTC
Created attachment 159228 [details] [review]
Force out arguments to be initialized as NULL.  Comes with a test.

This fix was motivated by a real world library which had a transfer full
utf8 out argument which sometimes was not set.  We would leave the pointer
dangling and try and free it at the end of invoke() and crash.  Library refused
to change their behavior so we're forced to take care of it on our end.
Comment 3 Zach Goldberg 2010-04-25 18:43:26 UTC
*bump* :)
Comment 4 Tomeu Vizoso 2010-04-26 08:37:22 UTC
Review of attachment 159228 [details] [review]:

Great!
Comment 5 Zach Goldberg 2010-04-26 16:30:51 UTC
Attachment 159228 [details] pushed as 8240320 - Force out arguments to be initialized as NULL.  Comes with a test.