From chu@gpz.gpz.fi Wed Jul  7 09:39:41 1999
Return-Path: <chu@gpz.gpz.fi>
Received: from gpz.gpz.fi (gpz.gpz.fi [194.252.66.194])
	by hub.freebsd.org (Postfix) with ESMTP id 967AF14C2E
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  7 Jul 1999 09:39:29 -0700 (PDT)
	(envelope-from chu@gpz.gpz.fi)
Received: (from chu@localhost)
	by gpz.gpz.fi (8.9.3/8.9.3) id TAA18288;
	Wed, 7 Jul 1999 19:39:26 +0300 (EEST)
	(envelope-from chu)
Message-Id: <199907071639.TAA18288@gpz.gpz.fi>
Date: Wed, 7 Jul 1999 19:39:26 +0300 (EEST)
From: Vladimir Tchoukharev <chu@gpz.gpz.fi>
Reply-To: chu@gpi.ru
To: FreeBSD-gnats-submit@freebsd.org
Subject: bc overflour
X-Send-Pr-Version: 3.2

>Number:         12550
>Category:       gnu
>Synopsis:       bc overflour
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    n_hibma
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul  7 09:40:01 PDT 1999
>Closed-Date:    Wed Jul 28 11:00:23 PDT 1999
>Last-Modified:  Wed Jul 28 11:00:44 PDT 1999
>Originator:     Vladimir Tchoukharev
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
>Environment:

World was made a week ago from -stable.

>Description:

bc (bc(1) - An arbitrary precision calculator language) dumps core 
on long line input (127 chars or more). The input doesn't matter.
 
>How-To-Repeat:

$ bc -l
bc 1.04

Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
3456789012345678901234567
Segmentation fault (core dumped)

$ cd /src/gnu/usr.bin/bc
$ file bc
bc: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked, not stripped
$ gdb bc ~/bc.core 
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...
(no debugging symbols found)...
Core was generated by `bc'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libreadline.so.3...
(no debugging symbols found)...done.
Reading symbols from /usr/lib/libtermcap.so.2...(no debugging symbols found)...
done.
Reading symbols from /usr/lib/libc.so.3...(no debugging symbols found)...done.
Reading symbols from /usr/libexec/ld-elf.so.1...(no debugging symbols found)...
done.
#0  0x280e6378 in strncpy () from /usr/lib/libc.so.3
(gdb) bt
#0  0x280e6378 in strncpy () from /usr/lib/libc.so.3
#1  0x804be82 in rl_input ()
#2  0x804c7e8 in yy_get_next_buffer ()
#3  0x804c5b5 in yylex ()
#4  0x8048dd1 in yyparse ()
#5  0x804bbff in main ()
#6  0x8048bbd in _start ()
(gdb) q

>Fix:
	
Regret, didn't find (yet).


>Release-Note:
>Audit-Trail:

From: Nick Hibma <nick.hibma@jrc.it>
To: freebsd-gnats-submit@freebsd.org, chu@gpi.ru
Cc:  
Subject: Re: gnu/12550: bc overflour
Date: Thu, 08 Jul 1999 19:27:19 +0200

 This problem is reproducible on CURRENT from last week.
 
 Nick
 -- 
 ISIS/STA, T.P.270, Joint Research Centre, 21020 Ispra, Italy
 
State-Changed-From-To: open->feedback 
State-Changed-By: n_hibma 
State-Changed-When: Sat Jul 24 11:26:23 PDT 1999 
State-Changed-Why:  
Bug fix posted, maybe he is willing to try it. 


Responsible-Changed-From-To: freebsd-bugs->n_hibma 
Responsible-Changed-By: n_hibma 
Responsible-Changed-When: Sat Jul 24 11:26:23 PDT 1999 
Responsible-Changed-Why:  
Remind me to apply the patch and close it. 

From: Nick Hibma <nick.hibma@jrc.it>
To: freebsd-gnats-submit@freebsd.org, chu@gpi.ru
Cc:  
Subject: Re: gnu/12550: bc overflour
Date: Sat, 24 Jul 1999 20:22:15 +0200

 Could you try the following patch?
 
 --- /usr/src/contrib/bc/bc/scan.l.orig  Sat Jul 24 20:19:04 1999
 +++ /usr/src/contrib/bc/bc/scan.l       Sat Jul 24 20:17:02 1999
 @@ -60,7 +60,7 @@
  /* Variables to help interface readline with bc. */
  static char *rl_line = (char *)NULL;
  static char *rl_start = (char *)NULL;
 -static char rl_len = 0;
 +static int  rl_len = 0;
  
  /* Definitions for readline access. */
  extern FILE *rl_instream;
 
 And let me know whether that works for you?
 
 For the record, this patch has also been sent off to
 Philip A. Nelson <phil@cs.wwu.edu>, the maintainer of bc.
 
 Cheers,
 
 Nick
 -- 
 ISIS/STA, T.P.270, Joint Research Centre, 21020 Ispra, Italy
 
State-Changed-From-To: feedback->closed 
State-Changed-By: n_hibma 
State-Changed-When: Wed Jul 28 11:00:23 PDT 1999 
State-Changed-Why:  
Committed. Thanks! 
>Unformatted:
