* [PATCH] Fix messed-up previous patch
@ 2021-04-25 1:19 Paul Eggert
0 siblings, 0 replies; only message in thread
From: Paul Eggert @ 2021-04-25 1:19 UTC (permalink / raw)
To: bug-gnulib; +Cc: Paul Eggert
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-25 1:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25 1:19 [PATCH] Fix messed-up previous patch Paul Eggert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).