This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix build warnings in locale/programs/ld-ctype.c


On 6/25/19 3:39 PM, Florian Weimer wrote:
* Stefan Liebler:

On 6/25/19 3:23 PM, Florian Weimer wrote:
* Stefan Liebler:

diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index e6105928da..cfc9c43fd5 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;

Maybe write:

    if (get_character (now, charmap, repertoire, &seq, &wch) != 0)

to match the other function calls?
Okay. That's no problem. If no one opposes, I'll commit the patch
tomorrow with "!= 0".

Shall I also update the following occurrence in ctype_read?
	      if (ellipsis_token == tok_none)
		{
		  if (get_character (now, charmap, repertoire, &seq, &wch))
		    goto err_label;

Oh, I had missed that.  If the calls are already inconsistent, you can
use your original patch, too.
Okay. Then I'll use the original patch.

To be honest, I'm more concerned about the other calls to get_character
without error checking.
Where do you see other ones?
With my patch applied, I just see the following occurrences of get_character which are now all checking the return value:
1257:get_character (struct token *now, const struct charmap_t *charmap,
1399:if (get_character (now, charmap, repertoire, &seq, &wch))
2291:if (get_character (now, charmap, repertoire, &seq, &wch))
2574:if (get_character (now, charmap, repertoire, &from_seq,
2585:if (get_character (now, charmap, repertoire, &to_seq,

Thanks,
Florian



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]