public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.34/master] intl: Avoid -Wuse-after-free [BZ #26779]
@ 2023-01-12 6:21 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2023-01-12 6:21 UTC (permalink / raw)
To: glibc-cvs
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-12 6:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 6:21 [glibc/release/2.34/master] intl: Avoid -Wuse-after-free [BZ #26779] Florian Weimer
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).