From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23001 invoked by alias); 3 Dec 2014 15:13:43 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 22956 invoked by uid 48); 3 Dec 2014 15:13:39 -0000 From: "bhaak at gmx dot net" To: glibc-bugs@sourceware.org Subject: [Bug libc/17674] New: ctype functions with wrong return values and crashes Date: Wed, 03 Dec 2014 15:13:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.20 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bhaak at gmx dot net X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg00031.txt.bz2 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.