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 634146 - Calls to g_win32_get_package_installation_directory_of_module() are never checked for NULL
Calls to g_win32_get_package_installation_directory_of_module() are never che...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.24.x
Other Windows
: Normal critical
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-11-06 06:43 UTC by Joshua Element Green
Modified: 2014-03-16 13:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch which fixes 2 possible NULL cases in _gtk_get_libdir (644 bytes, patch)
2010-11-06 06:43 UTC, Joshua Element Green
none Details | Review

Description Joshua Element Green 2010-11-06 06:43:53 UTC
Created attachment 173935 [details] [review]
Patch which fixes 2 possible NULL cases in _gtk_get_libdir

I was experiencing a crash with GTK 2.22.0 cross compiled for Windows with MinGW on Linux when a GTK theme was included in etc/gtk-2.0/gtkrc.

The private function _gtk_get_libdir is only built if G_OS_WIN32 is defined.  A call to 
g_win32_get_package_installation_directory_of_module (gtk_dll) is made and strrchr was executed on the return value.  Neither result was checked for NULL.

A NULL value could get returned from g_win32_get_package_installation_directory_of_module().

A NULL value WILL get returned if GTK is in the root folder of a disk drive, causing a crash.

Attached is a patch which checks for both cases.
Comment 1 Timothy Arceri 2013-10-01 06:46:12 UTC
Looking at the latest code there is now a check for the NULL that caused your crash. 

Looking a the g_win32_get_package_installation_directory_of_module() calls throughout gtkmain.c it doesnt look like the return value is ever checked for NULL.
Comment 2 Timothy Arceri 2013-10-01 06:57:15 UTC
The calls in gtkwin32.c (GTK3) don't check for NULL return values either.