arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone
Blob Blame History Raw
commit 363a98991884a744e78b9bfc7df89768901c0816
Author: Ondřej Bílka <neleai@seznam.cz>
Date:   Tue Dec 16 00:09:32 2014 +0100

    Return allocated array instead of unallocated.
    
    In locale/programs/ld-ctype.c we returned array that was on stack.
    Fixed by returning static array instead.

Index: b/locale/programs/ld-ctype.c
===================================================================
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -113,6 +113,9 @@ struct translit_include_t
   struct translit_include_t *next;
 };
 
+/* Provide some dummy pointer for empty string.  */
+static uint32_t no_str[] = { 0 };
+
 
 /* Sparse table of uint32_t.  */
 #define TABLE idx_table
@@ -1873,7 +1876,7 @@ find_translit2 (struct locale_ctype_t *c
 
 	  for (wi = tirunp->from; wi <= wch; wi += tirunp->step)
 	    if (wi == wch)
-	      return (uint32_t []) { 0 };
+	      return no_str;
 	}
     }
 
@@ -1927,7 +1930,7 @@ read_widestring (struct linereader *ldfi
 
   if (now->tok == tok_default_missing)
     /* The special name "" will denote this case.  */
-    wstr = ((uint32_t *) { 0 });
+    wstr = no_str;
   else if (now->tok == tok_bsymbol)
     {
       /* Get the value from the repertoire.  */
@@ -4244,12 +4247,9 @@ allocate_arrays (struct locale_ctype_t *
     }
   else
     {
-      /* Provide some dummy pointers since we have nothing to write out.  */
-      static uint32_t no_str = { 0 };
-
-      ctype->translit_from_idx = &no_str;
-      ctype->translit_from_tbl = &no_str;
-      ctype->translit_to_tbl = &no_str;
+      ctype->translit_from_idx = no_str;
+      ctype->translit_from_tbl = no_str;
+      ctype->translit_to_tbl = no_str;
       ctype->translit_idx_size = 0;
       ctype->translit_from_tbl_size = 0;
       ctype->translit_to_tbl_size = 0;