Skip to content
Snippets Groups Projects
Commit a37e6727 authored by Colin Walters's avatar Colin Walters
Browse files

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/
parent 01e934c1
Branches
Tags
No related merge requests found
...@@ -120,6 +120,8 @@ G_BEGIN_DECLS ...@@ -120,6 +120,8 @@ G_BEGIN_DECLS
#define _GLNX_HASH_TABLE_FOREACH_IMPL_KV(guard, ht, it, kt, k, vt, v) \ #define _GLNX_HASH_TABLE_FOREACH_IMPL_KV(guard, ht, it, kt, k, vt, v) \
gboolean guard = TRUE; \ gboolean guard = TRUE; \
G_STATIC_ASSERT (sizeof (kt) == sizeof (void*)); \
G_STATIC_ASSERT (sizeof (vt) == sizeof (void*)); \
for (GHashTableIter it; \ for (GHashTableIter it; \
guard && ({ g_hash_table_iter_init (&it, ht), TRUE; }); \ guard && ({ g_hash_table_iter_init (&it, ht), TRUE; }); \
guard = FALSE) \ guard = FALSE) \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment