diff options
| author | David Bremner <david@tethera.net> | 2017-02-22 06:17:47 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2017-02-22 06:28:03 -0400 |
| commit | 4e649d000b9d3764aea98cb0e1120947d7f76f3d (patch) | |
| tree | cd756c643a6485b0e0e16fdd239ddb63c156db71 /bindings/python | |
| parent | 928016a4ea0de23960b9c44b9f5d556b8878b5ab (diff) | |
lib: fix g_hash_table related read-after-free bug
The two g_hash_table functions (insert, add) have different behaviour
with respect to existing keys. g_hash_table_insert frees the new key,
while g_hash_table_add (which is really g_hash_table_replace in
disguise) frees the existing key. With this change 'ref' is live until
the end of the function (assuming single-threaded access to
'hash'). We can't guarantee it will continue to be live in the
future (i.e. there may be a future key duplication) so we copy it with
the allocation context passed to parse_references (in practice this is
the notmuch_message_t object whose parents we are finding).
Thanks to Tomi for the simpler approach to the problem based on
reading the fine glib manual.
Diffstat (limited to 'bindings/python')
0 files changed, 0 insertions, 0 deletions
