bin/100443 : awk(1) dies with SIGBUS when processing INDEX-6

Devon H. O'Dell devon.odell at coyotepoint.com
Thu Sep 14 14:40:30 PDT 2006


The following reply was made to PR bin/100443; it has been noted by GNATS.

From: "Devon H. O'Dell" <devon.odell at coyotepoint.com>
To: Dmitry Marakasov <amdmi3 at mail.ru>,  bug-followup at FreeBSD.org
Cc:  
Subject: Re: bin/100443 : awk(1) dies with SIGBUS when processing INDEX-6
Date: Thu, 14 Sep 2006 17:31:27 -0400

 This is a multi-part message in MIME format.
 --------------050206020800080501080703
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Got it. It was an off-by-one in fldbld(). Using the attached patch, I 
 now get:
 
  > ./run.sh
 p5-Task-Catalyst-1.90
 p5-Template-GD-2.66
 
 The patch is attached, seems to not modify other awk behavior (or crash 
 when the buffer becomes 8193 bytes, which it didn't anyway), and is also 
 available at http://databits.net/~dho/awk.patch
 
 Do we need to send this upstream?
 
 --Devon
 
 --------------050206020800080501080703
 Content-Type: text/plain;
  name="awk.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="awk.patch"
 
 Index: contrib/one-true-awk/lib.c
 ===================================================================
 RCS file: /home/ncvs/src/contrib/one-true-awk/lib.c,v
 retrieving revision 1.1.1.4
 diff -u -r1.1.1.4 lib.c
 --- contrib/one-true-awk/lib.c	16 May 2005 19:11:33 -0000	1.1.1.4
 +++ contrib/one-true-awk/lib.c	14 Sep 2006 21:27:10 -0000
 @@ -266,7 +266,7 @@
  		getsval(fldtab[0]);
  	r = fldtab[0]->sval;
  	n = strlen(r);
 -	if (n > fieldssize) {
 +	if (n >= fieldssize) {
  		xfree(fields);
  		if ((fields = (char *) malloc(n+1)) == NULL)
  			FATAL("out of space for fields in fldbld %d", n);
 
 --------------050206020800080501080703--


More information about the freebsd-bugs mailing list