GNOME Bugzilla – Bug 642944
NULL key lookup using g_hash_table_lookup_extended()
Last modified: 2011-02-25 15:42:16 UTC
In gnumeric we had in xlsx export: ---------------------------------------------------- authors = g_hash_table_new (g_str_hash, g_str_equal); for (ptr = objects; ptr; ptr = ptr->next) { authorname = cell_comment_author_get (CELL_COMMENT (ptr->data)); if (!g_hash_table_lookup_extended (authors, authorname, NULL, NULL)) g_hash_table_insert (authors, (gpointer) authorname, GUINT_TO_POINTER (author++)); } ---------------------------------------------------- If authorname happens to be NULL this crashed inside g_hash_table_lookup_extended although its documentation clearly indicates that NULL can be used as a lookup_key: Program received signal SIGSEGV, Segmentation fault. 0x01018733 in g_str_hash (v=0x0) at gstring.c:142 142 for (p = v; *p != '\0'; p++) We have the backtrace:
+ Trace 226054
You can only pass NULL if your hash and equal functions are NULL-safe. I've clarified the docs.