public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Fix build warnings in locale/programs/ld-ctype.c
@ 2019-06-26 10:32 Stefan Liebler
  0 siblings, 0 replies; only message in thread
From: Stefan Liebler @ 2019-06-26 10:32 UTC (permalink / raw)
  To: glibc-cvs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 2270 bytes --]

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9e6a7d9c179650478c8c34b8cf81a7699dc2ffe3

commit 9e6a7d9c179650478c8c34b8cf81a7699dc2ffe3
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Wed Jun 26 08:34:25 2019 +0200

    Fix build warnings in locale/programs/ld-ctype.c
    
    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.

Diff:
---
 ChangeLog                  | 5 +++++
 locale/programs/ld-ctype.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 7b7bccd..adc58e4 100644
--- 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.
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index e610592..cfc9c43 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -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.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-26 10:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26 10:32 [glibc] Fix build warnings in locale/programs/ld-ctype.c Stefan Liebler

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).