From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4032 invoked by alias); 25 Jul 2012 19:37:31 -0000 Received: (qmail 4013 invoked by uid 22791); 25 Jul 2012 19:37:30 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Jul 2012 19:37:17 +0000 From: "charles at hailoo dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug libc/14404] New: strtod causes invalid memory access on certain inputs Date: Wed, 25 Jul 2012 19:37: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-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: charles at hailoo dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-07/txt/msg00215.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14404 Bug #: 14404 Summary: strtod causes invalid memory access on certain inputs Product: glibc Version: 2.16 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: unassigned@sourceware.org ReportedBy: charles@hailoo.com CC: drepper.fsp@gmail.com Classification: Unclassified The function strtod in GLIBC, (implemented in stdlib/strtod_l.c), has a bug when checking for "inf" or "nan" in strtod_l.c. The issue causes Valgrind to report an invalid memory access. It can be reproduced easily by simply trying to use strtod on a string that starts with the letter "i" or "n": char* s = malloc(12); memset(s, 0, 12); strcpy(s, "ichabod"); double v = std::strtod(s, NULL); This causes Valgrind to report: ==20062== Invalid read of size 8 ==20062== at 0x565A147: __GI___strncasecmp_l (strcmp.S:215) ==20062== by 0x5610F5E: ____strtod_l_internal (strtod_l.c:577) ==20062== by 0x404B43: main (test4.cc:310) ==20062== Address 0x5971048 is 8 bytes inside a block of size 12 alloc'd ==20062== at 0x4C28F9F: malloc (vg_replace_malloc.c:236) ==20062== by 0x404B07: main (test4.cc:307) The bug seems to have something to do with the use of STRNCASECMP macro when checking for "inf" and "nan". -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.