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] |
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
Attachment:
vfscanf.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |