Created attachment 170884 [details] Test program that reproduces the issue I noticed that when using wcsrtombs, if a character is encountered that can not be converted, it sets errno to EILSEQ and returns (size_t)-1. However *src still points to the original character, even though it should point to the character after the one that conversion stopped at. I've attached a test program that reproduces the issue. The expected output is: inptr - in: 7 The actual output is: inptr - in: 0 The culprit appears to be in _ascii_wcsnrtombs, line 181 in lib/libc/locale/ascii.c: it's missing a "*src = s;" statement before the return.
A commit references this bug: Author: ache Date: Tue May 31 18:44:34 UTC 2016 New revision: 301069 URL: https://svnweb.freebsd.org/changeset/base/301069 Log: For EILSEQ case in mbsnrtowcs() and wcsnrtombs() update src to point to the character after the one this conversion stopped at. PR: 209907 Submitted by: Roel Standaert <roel@abittechnical.com> (partially) MFC after: 3 days Changes: head/lib/libc/locale/ascii.c head/lib/libc/locale/none.c
A commit references this bug: Author: ache Date: Fri Jun 3 07:35:00 UTC 2016 New revision: 301245 URL: https://svnweb.freebsd.org/changeset/base/301245 Log: For EILSEQ case in mbsnrtowcs() and wcsnrtombs() update src to point to the character after the one this conversion stopped at. PR: 209907 Submitted by: Roel Standaert <roel@abittechnical.com> (partially) Changes: _U stable/10/ stable/10/lib/libc/locale/ascii.c stable/10/lib/libc/locale/none.c