public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17674] New: ctype functions with wrong return values and crashes
@ 2014-12-03 15:13 bhaak at gmx dot net
  2014-12-03 15:28 ` [Bug libc/17674] " schwab@linux-m68k.org
  0 siblings, 1 reply; 2+ messages in thread
From: bhaak at gmx dot net @ 2014-12-03 15:13 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 17674
           Summary: ctype functions with wrong return values and crashes
           Product: glibc
           Version: 2.20
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: bhaak at gmx dot net
                CC: drepper.fsp at gmail dot com

Created attachment 7992
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7992&action=edit
C code demonstrating wrong return values and crash of isblank

The ctype functions (probably all, I tested with isblank, isspace, and isalpha)
return wrong results if they are called with int values bigger than UCHAR_MAX.

Furthermore, for some big int values it crashes with a segmentation fault.

The attached C file outputs all values from 0 to INT_MAX which return true from
isblank. On a Gentoo machine it crashed with 151056, on an Ubuntu machine with
163152.

I know that the ctype functions are technically in POSIX only defined for
values representable as an unsigned char or the value of EOF but this is stupid
nevertheless for a library function.

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


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

* [Bug libc/17674] ctype functions with wrong return values and crashes
  2014-12-03 15:13 [Bug libc/17674] New: ctype functions with wrong return values and crashes bhaak at gmx dot net
@ 2014-12-03 15:28 ` schwab@linux-m68k.org
  0 siblings, 0 replies; 2+ messages in thread
From: schwab@linux-m68k.org @ 2014-12-03 15:28 UTC (permalink / raw)
  To: glibc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
This is perfectly valid undefined behaviour.

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


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

end of thread, other threads:[~2014-12-03 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-03 15:13 [Bug libc/17674] New: ctype functions with wrong return values and crashes bhaak at gmx dot net
2014-12-03 15:28 ` [Bug libc/17674] " schwab@linux-m68k.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).