]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix build warnings in locale/programs/ld-ctype.c
authorStefan Liebler <stli@linux.ibm.com>
Wed, 26 Jun 2019 06:34:25 +0000 (08:34 +0200)
committerStefan Liebler <stli@linux.ibm.com>
Wed, 26 Jun 2019 06:34:25 +0000 (08:34 +0200)
This patch fixes the gcc warnings seen with gcc 9 -march>=z13 on s390x:
programs/ld-ctype.c: In function ‘ctype_read’:
programs/ld-ctype.c:1392:13: error: ‘wch’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1392 |    uint32_t wch;
      |             ^~~
programs/ld-ctype.c:1401:7: error: ‘seq’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1401 |    if (seq != NULL && seq->nbytes == 1)
      |       ^
programs/ld-ctype.c:1391:20: note: ‘seq’ was declared here
 1391 |    struct charseq *seq;
      |                    ^~~

Both seq and wch are uninitialized if get_character fails.
Thus we are now returning with an error.

ChangeLog:

* locale/programs/ld-ctype.c (charclass_symbolic_ellipsis):
Return error if get_character fails.

ChangeLog
locale/programs/ld-ctype.c

index 7b7bccde4c5de83ce7738d818a5c658bb3792eec..adc58e4a14a8c4e84e761f7f8d2842abd5578413 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-26  Stefan Liebler  <stli@linux.ibm.com>
+
+       * locale/programs/ld-ctype.c (charclass_symbolic_ellipsis):
+       Return error if get_character fails.
+
 2019-06-25  Stefan Liebler  <stli@linux.ibm.com>
 
        * sysdeps/s390/fpu/libm-test-ulps: Regenerated.
index e6105928da2350208eb8f7ae21e330949b1efe7f..cfc9c43fd58235a3b3ee630cc40afc39fe108c05 100644 (file)
@@ -1396,7 +1396,8 @@ charclass_symbolic_ellipsis (struct linereader *ldfile,
                   (int) (now->val.str.lenmb - (cp - last_str)),
                   from);
 
-         get_character (now, charmap, repertoire, &seq, &wch);
+         if (get_character (now, charmap, repertoire, &seq, &wch))
+           goto invalid_range;
 
          if (seq != NULL && seq->nbytes == 1)
            /* Yep, we can store information about this byte sequence.  */