This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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] stdio/vfscanf.c: Handle non-ASCII chars and invalid bytes in format string


Jeff?  Ping?

On Jan 12 22:10, Andy Koppe wrote:
> Similarly to Corinna's patch for vfprintf, here's a patch for vfscanf
> that corrects its handling of non-ASCII chars and allows invalid bytes
> in the format string.
> 
> The code currently has a comparison between a signed and an unsigned
> char at line 552, which causes matching of any non-ASCII characters in
> the format string to always fail. It also wrongly resets the multibyte
> conversion state after every character. (The standard at
> http://www.opengroup.org/onlinepubs/000095399/functions/fscanf.html
> says "the format is a character string, beginning and ending in its
> initial shift state"). Finally, %lc and %ls conversions use the same
> conversion state as is used for the format string, thereby clobbering
> the format string state.
> 
> The patch addresses those issues and also allows invalid bytes in the
> format string to be matched. (Invalid bytes currently cause the format
> string parsing to go backwards, since __mbtowc in line 510 will return
> -1 in that case.)
> 
> ChangeLog:
>         * libc/stdio/vfscanf.c (__SVFSCANF_R): Fix handling of non-ASCII
>         characters and allow invalid bytes in format string.
> 
> Andy



-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


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