]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-mempool.c: Ensure element_size is at least sizeof(void *)
authorAlex Richardson <arichardson.kde@gmail.com>
Sun, 22 May 2022 22:08:32 +0000 (22:08 +0000)
committerAlex Richardson <arichardson.kde@gmail.com>
Sun, 22 May 2022 22:54:34 +0000 (22:54 +0000)
I am trying to use DBus on an Arm Morello system where sizeof(void *) is
16 and not 8, so the assertion in the line below can fail unless we ensure
that element_size is at least sizeof(void *).

dbus/dbus-mempool.c

index 83aa2722aacb1c3cd2aaa91eae5e47462010e366..737cf201e5e4e45d71baba0b42032b92db21f30f 100644 (file)
@@ -149,7 +149,9 @@ _dbus_mem_pool_new (int element_size,
   /* Make the element size at least 8 bytes. */
   if (element_size < 8)
     element_size = 8;
-  
+  if (element_size < (int) sizeof (void *))
+    element_size = sizeof (void *);
+
   /* these assertions are equivalent but the first is more clear
    * to programmers that see it fail.
    */