--- ChangeLog | 2 ++ lib/malloca.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog index f91f2e3df..3a21db4f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ PTRDIFF_MAX. * lib/xalloc-oversized.h: Adjust comment to match. + xmalloca, etc.: fix some xalloc-oversized issues + * lib/malloca.h (nmalloca): * lib/xmalloca.h (xnmalloca): Convert S to ptrdiff_t to avoid arithmetic overflow if N and S are both narrower than ptrdiff_t. * lib/xalloc-oversized.h (xalloc_oversized): diff --git a/lib/malloca.h b/lib/malloca.h index f9b30880d..a255e3f04 100644 --- a/lib/malloca.h +++ b/lib/malloca.h @@ -79,7 +79,7 @@ extern void freea (void *p); on the stack. S must be positive and N must be nonnegative. The array must be freed using freea() before the function returns. */ #define nmalloca(n, s) \ - (xalloc_oversized (n, s) ? NULL : malloca ((n) * (ptrdiff_t) (s))) + (xalloc_oversized (n, s) ? NULL : malloca ((n) * (size_t) (s))) #ifdef __cplusplus -- 2.27.0