diff options
author | Colin Walters <walters@verbum.org> | 2017-06-30 12:11:14 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2017-06-30 12:17:49 -0400 |
commit | a37e672739197b8a7f3bdfe3f17099fe402f9a98 (patch) | |
tree | 71cfcc5751392f1f47ba452471f48911c24b2511 /glnx-macros.h | |
parent | 01e934c18efdbac071ebc19a8a95916d324970c9 (diff) | |
download | libglnx-a37e672739197b8a7f3bdfe3f17099fe402f9a98.tar.gz |
macros: Add a size check for hashtable iters
If the user provides a less than pointer-sized type, we'll clobber other things
on the stack.
See https://github.com/ostreedev/ostree/pull/990/
Diffstat (limited to 'glnx-macros.h')
-rw-r--r-- | glnx-macros.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/glnx-macros.h b/glnx-macros.h index 24705af..1d4e175 100644 --- a/glnx-macros.h +++ b/glnx-macros.h @@ -120,6 +120,8 @@ G_BEGIN_DECLS #define _GLNX_HASH_TABLE_FOREACH_IMPL_KV(guard, ht, it, kt, k, vt, v) \ gboolean guard = TRUE; \ + G_STATIC_ASSERT (sizeof (kt) == sizeof (void*)); \ + G_STATIC_ASSERT (sizeof (vt) == sizeof (void*)); \ for (GHashTableIter it; \ guard && ({ g_hash_table_iter_init (&it, ht), TRUE; }); \ guard = FALSE) \ |