public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/16950] New: mbrtowc on empty buffer returns 0, should return (size_t) -2
@ 2014-05-16  1:16 eggert at gnu dot org
  2015-02-18 14:40 ` [Bug libc/16950] " fweimer at redhat dot com
  2015-08-27 22:22 ` [Bug locale/16950] " jsm28 at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: eggert at gnu dot org @ 2014-05-16  1:16 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16950

            Bug ID: 16950
           Summary: mbrtowc on empty buffer returns 0, should return
                    (size_t) -2
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: eggert at gnu dot org
                CC: drepper.fsp at gmail dot com

Created attachment 7602
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7602&action=edit
demonstrate the mbrtowc-on-empty-buffer bug

Invoking mbrtowc (&wc, buf, 0, &mbs) should return (size_t) -2, because an
empty buffer's zero bytes "contribute to an incomplete but potentially valid
character", which is what POSIX says (size_t) -2 means.  However, mbrtowc
returns 0.  This is incorrect, as 0 should be returned only if the empty
buffer's zero bytes "complete the character that corresponds to the null wide
character", which is not what's happening here.

Other platforms I've tried seem to get this right, e.g., Solaris 10.

Compile and run the attached program mbrtowc-bug.c to demonstrate the bug.  It
outputs "mbrtowc (A, B, 0, D) == 0x0, should be 0xfffffffffffffffe".

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/16950] mbrtowc on empty buffer returns 0, should return (size_t) -2
  2014-05-16  1:16 [Bug libc/16950] New: mbrtowc on empty buffer returns 0, should return (size_t) -2 eggert at gnu dot org
@ 2015-02-18 14:40 ` fweimer at redhat dot com
  2015-08-27 22:22 ` [Bug locale/16950] " jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: fweimer at redhat dot com @ 2015-02-18 14:40 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16950

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
              Flags|                            |security?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug locale/16950] mbrtowc on empty buffer returns 0, should return (size_t) -2
  2014-05-16  1:16 [Bug libc/16950] New: mbrtowc on empty buffer returns 0, should return (size_t) -2 eggert at gnu dot org
  2015-02-18 14:40 ` [Bug libc/16950] " fweimer at redhat dot com
@ 2015-08-27 22:22 ` jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-08-27 22:22 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16950

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libc                        |locale

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-27 22:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-16  1:16 [Bug libc/16950] New: mbrtowc on empty buffer returns 0, should return (size_t) -2 eggert at gnu dot org
2015-02-18 14:40 ` [Bug libc/16950] " fweimer at redhat dot com
2015-08-27 22:22 ` [Bug locale/16950] " jsm28 at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).