bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH] Fix messed-up previous patch
Date: Sat, 24 Apr 2021 18:19:11 -0700	[thread overview]
Message-ID: <20210425011911.339393-1-eggert@cs.ucla.edu> (raw)

---
 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



                 reply	other threads:[~2021-04-25  1:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210425011911.339393-1-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).