This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17674] New: ctype functions with wrong return values and crashes


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]