[Bug 209907] _ascii_wcsnrtombs neglects to set src on EILSEQ error

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue May 31 17:09:04 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209907

            Bug ID: 209907
           Summary: _ascii_wcsnrtombs neglects to set src on EILSEQ error
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: freebsd-standards at FreeBSD.org
          Reporter: roel at abittechnical.com

Created attachment 170884
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=170884&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-standards mailing list