NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/38840: make chokes on long lines



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 03 01:10:00 +0000 2008
>Originator:     Pierre Pronchery <khorben%defora.org@localhost>
>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@localhost:/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;

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


Home | Main Index | Thread Index | Old Index