forked from rpms/glibc
ad85e10075
Upstream commit: commit 6484ae5b8c4d4314f748e4d3c9a9baa5385e57c5 - malloc: Fix -Wuse-after-free warning in tst-mallocalign1 [BZ #26779] - s_sincosf.h: Change pio4 type to float [BZ #28713] - math: Properly cast X_TLOSS to float [BZ #28713] - Regenerate ulps on x86_64 with GCC 12 - Avoid -Wuse-after-free in tests [BZ #26779]. - Fix build of nptl/tst-thread_local1.cc with GCC 12 - Fix stdio-common tests for GCC 12 -Waddress - Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare - resolv: Avoid GCC 12 false positive warning [BZ #28439]. - intl: Avoid -Wuse-after-free [BZ #26779] - elf: Drop elf/tls-macros.h in favor of __thread and tls_model attributes [BZ #28152] [BZ #28205] - time: Set daylight to 1 for matching DST/offset change (RHBZ#2155352) - elf/tst-tlsopt-powerpc fails when compiled with -mcpu=power10 (BZ# 29776) - time: Use 64 bit time on tzfile - nscd: Use 64 bit time_t on libc nscd routines (BZ# 29402) - nis: Build libnsl with 64 bit time_t - Use LFS and 64 bit time for installed programs (BZ #15333) Resolves: #2155352 Related: #2160734
40 lines
1.3 KiB
Diff
40 lines
1.3 KiB
Diff
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 --git a/intl/localealias.c b/intl/localealias.c
|
|
index 375af2b03153acce..28041f2a48f643fa 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;
|
|
}
|