]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
intl: Merge from glibc.
authorBruno Haible <bruno@clisp.org>
Sat, 30 Sep 2023 18:54:00 +0000 (20:54 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 30 Sep 2023 22:36:55 +0000 (00:36 +0200)
Apply commit
2022-01-25  Martin Sebor  <msebor@redhat.com>
intl: Avoid -Wuse-after-free [BZ #26779]

gettext-runtime/intl/localealias.c

index 5c7eadf696fa2f362911fd6d5101c876672601f3..d1de252badc4900b0921cea4f1c2e54023aec940 100644 (file)
@@ -363,7 +363,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));
@@ -396,6 +404,8 @@ read_alias_file (const char *fname, int fname_len)
                                           value, value_len);
                  string_space_act += value_len;
 
+#pragma GCC diagnostic pop
+
                  ++nmap;
                  ++added;
                }