Subject: bin/5793: bc core dumps doing big number computations
To: None <gnats-bugs@gnats.netbsd.org>
From: Patrick Welche,SCC,ext.30488, <prlw1@newn.cam.ac.uk>
List: netbsd-bugs
Date: 07/18/1998 12:55:03
>Number:         5793
>Category:       bin
>Synopsis:       bc core dumps doing big number computations
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 18 05:05:01 1998
>Last-Modified:
>Originator:     Patrick Welche
>Organization:
        
>Release:        NetBSD-current 14 July 1998
>Environment:
System: NetBSD i386 1.3F  Wed Jul 15 16:57:50 BST 1998


>Description:
Problem occured while testing SSLeay's big number library which checks its
answers with bc. bc gets a segmentation fault:

#0  0x4007ee50 in strncpy ()
#1  0xbc7e in rl_input (
    buf=0x2a000 "obase=16\nibase=16\nC013B008A91EE8545A751BC897EB2ED62840064A18BDA6B935ABC55547D91B1463DBF7F8821A874114
7EF5E0F97F9B38EFDD52F7AA34B117B41E5217CB30995F + 36BFABB5ED7AF6D72338F5F5E9D70F0FACBE48CA3FAFD4E0D73"..., 
    result=0x14c6c, max=8192) at /usr/src/gnu/usr.bin/bc/scan.l:118
#2  0xca91 in yy_get_next_buffer () at lex.yy.c:1519
#3  0xc72d in yylex () at lex.yy.c:1354
#4  0x369d in yyparse () at bc.tab.c:1445
#5  0x756a in main (argc=1, argv=0xefbfd648)
    at /usr/src/gnu/usr.bin/bc/main.c:219

>How-To-Repeat:
Run bc and type in the string shown in buf above (obviously \n -> cr)
>Fix:
Replace the 1.04 version we have in the src/gnu/usr.bin/bc tree with version
1.05a which fixes the problem. I didn't bother trying to spot the difference
between 1.04 and 1.05a to discover what in particular fixes this problem.
>Audit-Trail:
>Unformatted: