public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/release/2.34/master] intl: Avoid -Wuse-after-free [BZ #26779]
Date: Thu, 12 Jan 2023 06:21:16 +0000 (GMT)	[thread overview]
Message-ID: <20230112062116.4B6163858D35@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d36f457870a807f6f29880a2f2bde5e9b761f00c

commit d36f457870a807f6f29880a2f2bde5e9b761f00c
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jan 25 17:38:31 2022 -0700

    intl: Avoid -Wuse-after-free [BZ #26779]
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 7845064d2d5a50e347ee9f4b78ec5e6316190154)

Diff:
---
 intl/localealias.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/intl/localealias.c b/intl/localealias.c
index 375af2b031..28041f2a48 100644
--- a/intl/localealias.c
+++ b/intl/localealias.c
@@ -318,7 +318,15 @@ read_alias_file (const char *fname, int fname_len)
 
 		  if (string_space_act + alias_len + value_len > string_space_max)
 		    {
-		      /* Increase size of memory pool.  */
+#pragma GCC diagnostic push
+
+#if defined __GNUC__ && __GNUC__ >= 12
+  /* Suppress the valid GCC 12 warning until the code below is changed
+     to avoid using pointers to the reallocated block.  */
+#  pragma GCC diagnostic ignored "-Wuse-after-free"
+#endif
+
+		    /* Increase size of memory pool.  */
 		      size_t new_size = (string_space_max
 					 + (alias_len + value_len > 1024
 					    ? alias_len + value_len : 1024));
@@ -351,6 +359,8 @@ read_alias_file (const char *fname, int fname_len)
 					   value, value_len);
 		  string_space_act += value_len;
 
+#pragma GCC diagnostic pop
+
 		  ++nmap;
 		  ++added;
 		}

                 reply	other threads:[~2023-01-12  6:21 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

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

  git send-email \
    --in-reply-to=20230112062116.4B6163858D35@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.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).