This is the mail archive of the
mailing list for the glibc project.
Re: Pointer to invalid multibyte sequence in mbsnrtowcs()
- From: Florian Weimer <fweimer at redhat dot com>
- To: Igor Liferenko <igor dot liferenko at gmail dot com>, libc-help at sourceware dot org
- Date: Mon, 19 Dec 2016 15:31:42 +0100
- Subject: Re: Pointer to invalid multibyte sequence in mbsnrtowcs()
- Authentication-results: sourceware.org; auth=none
- References: <CAJyx361JOYOb_DpVWRjYTQ+DSkCT2SxMcV-BF-M5e0-BQd8Gvg@mail.gmail.com>
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
Consider the following examples:
Example 1 (at the end of buffer):
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.