]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - malloc/tst-posix_memalign.c
malloc: Fix for infinite loop in memalign/posix_memalign.
[thirdparty/glibc.git] / malloc / tst-posix_memalign.c
index 27c0dd2bd406ac5db6a9e58498c2245563ac8048..7f34e37bd2b26f8fad08a5b5bf6db24b6beaff52 100644 (file)
@@ -65,6 +65,16 @@ do_test (void)
 
   p = NULL;
 
+  /* Test to expose integer overflow in malloc internals from BZ #16038.  */
+  ret = posix_memalign (&p, -1, pagesize);
+
+  if (ret != EINVAL)
+    merror ("posix_memalign (&p, -1, pagesize) succeeded.");
+
+  free (p);
+
+  p = NULL;
+
   /* A zero-sized allocation should succeed with glibc, returning zero
      and setting p to a non-NULL value.  */
   ret = posix_memalign (&p, sizeof (void *), 0);