public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] intl: Avoid -Wuse-after-free [BZ #26779]
@ 2022-01-26 2:58 Martin Sebor
0 siblings, 0 replies; only message in thread
From: Martin Sebor @ 2022-01-26 2:58 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7845064d2d5a50e347ee9f4b78ec5e6316190154
commit 7845064d2d5a50e347ee9f4b78ec5e6316190154
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>
Diff:
---
intl/localealias.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/intl/localealias.c b/intl/localealias.c
index 3ae360f40d..b36092363a 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:[~2022-01-26 2:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 2:58 [glibc] intl: Avoid -Wuse-after-free [BZ #26779] Martin Sebor
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).