NetBSD Problem Report #38840

From khorben@defora.org  Tue Jun  3 01:05:24 2008
Return-Path: <khorben@defora.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id CF6F463BA89
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  3 Jun 2008 01:05:23 +0000 (UTC)
Message-Id: <20080603010516.28AD3FEE1@exxh.defora.lan>
Date: Tue,  3 Jun 2008 03:05:16 +0200 (CEST)
From: Pierre Pronchery <khorben@defora.org>
Reply-To:
To: gnats-bugs@gnats.NetBSD.org
Subject: make chokes on long lines
X-Send-Pr-Version: 3.95

>Number:         38840
>Category:       bin
>Synopsis:       make crashes while parsing long lines in Makefiles
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 03 01:10:00 +0000 2008
>Closed-Date:    Tue Jun 03 13:03:01 +0000 2008
>Last-Modified:  Sun Nov 23 18:25:01 +0000 2008
>Originator:     Pierre Pronchery <khorben@defora.org>
>Release:        NetBSD 4.99.63
>Organization:
>Environment:
System: NetBSD exxh.defora.lan 4.99.63 NetBSD 4.99.63 (GENERIC.MP) #0: Wed May 21 20:10:41 CEST 2008 khorben@exxh.defora.lan:/usr/obj/sys/arch/sparc64/compile/GENERIC.MP sparc64
Architecture: sparc64
Machine: sparc64
>Description:
make crashes when parsing lines over 64K characters. I get segmentation
faults on i386 (read access to invalid memory), or an "invalid argument"
error on amd64 and sparc64 (all reliably).
This is because the position pointer is not updated when reallocating
the read buffer.
>How-To-Repeat:
Create such a Makefile, the long command can be escaped over multiple
lines. Run "make" from within the same directory.
>Fix:
Apply patch below:

--- parse.c.orig	2008-06-03 02:54:35.000000000 +0200
+++ parse.c	2008-06-03 02:53:11.000000000 +0200
@@ -2193,6 +2193,7 @@
 		if (len <= 0) {
 		    /* We need a bigger buffer to hold this line */
 		    tp = erealloc(cf->P_str, cf->P_buflen + IFILE_BUFLEN);
+		    cf->P_ptr = cf->P_ptr - cf->P_str + tp;
 		    cf->P_end = cf->P_end - cf->P_str + tp;
 		    ptr = ptr - cf->P_str + tp;
 		    line = line - cf->P_str + tp;

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: christos@NetBSD.org
State-Changed-When: Tue, 03 Jun 2008 09:03:01 -0400
State-Changed-Why:
fixed, thanks


From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38840 CVS commit: src/usr.bin/make
Date: Tue,  3 Jun 2008 13:02:28 +0000 (UTC)

 Module Name:	src
 Committed By:	christos
 Date:		Tue Jun  3 13:02:28 UTC 2008

 Modified Files:
 	src/usr.bin/make: parse.c

 Log Message:
 PR/38840: Pierre Pronchery: make crashes while parsing long lines in Makefiles


 To generate a diff of this commit:
 cvs rdiff -r1.145 -r1.146 src/usr.bin/make/parse.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38840 CVS commit: [netbsd-4] src/usr.bin/make
Date: Sun, 23 Nov 2008 18:20:39 +0000 (UTC)

 Module Name:	src
 Committed By:	bouyer
 Date:		Sun Nov 23 18:20:39 UTC 2008

 Modified Files:
 	src/usr.bin/make [netbsd-4]: parse.c

 Log Message:
 Pull up following revision(s) (requested by dsl in ticket #1240):
 	usr.bin/make/parse.c: revision 1.146
 PR/38840: Pierre Pronchery: make crashes while parsing long lines in Makefiles


 To generate a diff of this commit:
 cvs rdiff -r1.120.2.4 -r1.120.2.5 src/usr.bin/make/parse.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:
 src/usr.bin/make/parse.c 1.145

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.