Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 May 2016 17:09:04 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-standards@FreeBSD.org
Subject:   [Bug 209907] _ascii_wcsnrtombs neglects to set src on EILSEQ error
Message-ID:  <bug-209907-15@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

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@FreeBSD.org
          Reporter: roel@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.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-209907-15>