Pointer to invalid multibyte sequence in mbsnrtowcs()
Mon Dec 19 14:31:00 GMT 2016
On 12/19/2016 05:52 AM, Igor Liferenko wrote:
> Contrary to mbsnrtowcs(3), *src is not left pointing to the invalid multibyte
> sequence after mbsnrtowcs() completes.
> There are two possible cases:
> 1) incomplete multibyte character is at the end of input buffer *)
> 2) incomplete multibyte character is not at the end of input buffer *)
> *) - end of buffer is determined by nms argument.
> But in either case *src is unchanged. Am I missing something obvious or it is
> a bug?
> Consider the following examples:
> Example 1 (at the end of buffer):
> #include <locale.h>
> #include <wchar.h>
> #include <stdio.h>
> #include <string.h>
> int main(void)
> setlocale(LC_CTYPE, "en_US.UTF-8");
> char *s = "\321\216\321";
I'm not sure if this example demonstrates the behavior you describe
because the string starts with an invalid multibyte sequence, so I would
expect mbsnrtowcs not t advance the read pointer in this case.
More information about the Libc-help