Null check in g_hash_table_lookup()
- From: Michael McConville <mmcconv1 sccs swarthmore edu>
- To: gtk-devel-list gnome org
- Subject: Null check in g_hash_table_lookup()
- Date: Sat, 15 Aug 2015 16:27:22 -0400
Currently, if you pass a null key pointer to g_hash_table_lookup(), it
will sometimes segfault in g_str_hash(). This often happened in the
Pidgin development tip until we added this check:
https://hg.pidgin.im/pidgin/main/rev/7e57fa4513f4
I was running GLib 2.44.1 on OpenBSD 5.8 (-current).
It seems like adding:
g_return_val_if_fail (key != NULL, NULL);
Here:
https://github.com/GNOME/glib/blob/master/glib/ghash.c#L1145
Should fix it. However, it seems saliently missing, so maybe I'm
misunderstanding and NULL can be a valid key pointer.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]