From owner-freebsd-bugs Tue Jun 4 0:50:19 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E3B6437B405 for ; Tue, 4 Jun 2002 00:50:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g547o1j51447; Tue, 4 Jun 2002 00:50:01 -0700 (PDT) (envelope-from gnats) Received: from speechpro.com (crt-gw.infopro.spb.su [195.201.254.5]) by hub.freebsd.org (Postfix) with ESMTP id F3C4D37B401 for ; Tue, 4 Jun 2002 00:47:35 -0700 (PDT) Received: from drweb by sysadm.stc with drweb-scanned (Exim 3.36 #1) id 17F92h-000K3o-00 for FreeBSD-gnats-submit@freebsd.org; Tue, 04 Jun 2002 11:47:47 +0400 Received: from igorr by sysadm.stc with local (Exim 3.36 #1) id 17F92h-000K3e-00 for FreeBSD-gnats-submit@freebsd.org; Tue, 04 Jun 2002 11:47:47 +0400 Message-Id: Date: Tue, 04 Jun 2002 11:47:47 +0400 From: Igor Roboul Reply-To: Igor Roboul To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: misc/38884: bug in vfprinf.c function cvt(...) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 38884 >Category: misc >Synopsis: bug in vfprinf.c function cvt(...) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 04 00:50:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Igor Roboul >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD sysadm.stc 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Thu May 30 16:13:28 MSD 2002 root@sysadm.stc:/opt/freebsd/obj/opt/freebsd/src/sys/SYSADM i386 >Description: Function cvt(double value, int ndigits, int flags, char *sign, int *decpt, int ch, int *length, char **dtoaresultp) in vfprintf.c does not check return value of __dtoa(...) for NaN or Infinity value. Because of this mutt (mail program from ports) sometimes crashes with Sig 10 in vfprintf when showing list of attachments or after exitiong from editor when composing new message. >How-To-Repeat: Launch mutt. Then open some mail with attachments, then try get list of attachments (press 'v'). Sometimes, really often, mutt crashes with Signal 10. Same result you can get if you try send new message. >Fix: I have changed function cvt(...) in file /usr/src/lib/libc/stdio/vfprintf.c so it checks for *decpt!=9999 (as commented in function __dtoa(...) in file /usr/src/lib/libc/stdlib/strtod.c, value 9999 for *decpt indicates Infinity or NaN) Patch bellow: --- vfprintf.c.orig Mon Jun 3 16:27:59 2002 +++ vfprintf.c Tue Jun 4 11:08:59 2002 @@ -1415,17 +1415,19 @@ digits = __dtoa(value, mode, ndigits, decpt, &dsgn, &rve, dtoaresultp); if ((ch != 'g' && ch != 'G') || flags & ALT) { - /* print trailing zeros */ - bp = digits + ndigits; - if (ch == 'f') { - if (*digits == '0' && value) - *decpt = -ndigits + 1; - bp += *decpt; - } - if (value == 0) /* kludge for __dtoa irregularity */ - rve = bp; - while (rve < bp) - *rve++ = '0'; + if(*decpt != 9999 ) { /* not (Infinity or NaN) */ + /* print trailing zeros */ + bp = digits + ndigits; + if (ch == 'f') { + if (*digits == '0' && value) + *decpt = -ndigits + 1; + bp += *decpt; + } + if (value == 0) /* kludge for __dtoa irregularity */ + rve = bp; + while (rve < bp) + *rve++ = '0'; + } } *length = rve - digits; return (digits); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message