Subject: bin/2594: dc core dumps when setting output base
To: None <gnats-bugs@NetBSD.ORG>
From: Arne Henrik Juul <arnej@imf.unit.no>
List: netbsd-bugs
Date: 07/02/1996 10:37:14
>Number: 2594
>Category: bin
>Synopsis: dc core dumps when setting output base
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 2 04:50:02 1996
>Last-Modified:
>Originator: Arne H. Juul
>Organization:
Norwegian University of Technology and Science
>Release: 1.2_ALPHA
>Environment:
System: NetBSD leon.imf.unit.no 1.2_ALPHA NetBSD 1.2_ALPHA (NIKITA) #1: Sun Jun 9 05:11:29 MET DST 1996 arnej@leon.imf.unit.no:/usr/src/sys/arch/i386/compile/NIKITA i386
>Description:
After the last bc/number.c shuffle, dc core dumps when setting
output base.
>How-To-Repeat:
leon:~:(305)$ dc
10 p 16 o p
10
Bus error (core dumped)
>Fix:
Apply this patch:
--- /usr/src/gnu/usr.bin/bc/number.c.orig Wed Jun 5 13:18:06 1996
+++ /usr/src/gnu/usr.bin/bc/number.c Tue Jul 2 00:17:03 1996
@@ -1236,7 +1236,7 @@
char *nptr;
int index, fdigit, pre_space;
stk_rec *digits, *temp;
- bc_num int_part, frac_part, base, cur_dig, t_num, max_o_digit;
+ bc_num int_part, frac_part, base, cur_dig, max_o_digit;
/* The negative sign if needed. */
if (num->n_sign == MINUS) (*out_char) ('-');
@@ -1319,6 +1319,8 @@
/* Get and print the digits of the fraction part. */
if (num->n_scale > 0)
{
+ bc_num t_num;
+
(*out_char) ('.');
pre_space = 0;
t_num = copy_num (_one_);
@@ -1335,6 +1337,7 @@
}
bc_multiply (t_num, base, &t_num, 0);
}
+ free_num (&t_num);
}
/* Clean up. */
@@ -1342,7 +1345,6 @@
free_num (&frac_part);
free_num (&base);
free_num (&cur_dig);
- free_num (&t_num);
free_num (&max_o_digit);
}
}
>Audit-Trail:
>Unformatted: