NetBSD-Bugs archive

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

Re: bin/52737 (bmake crash for invalid usage of .PATH)



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

From: Christos Zoulas <christos%zoulas.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: sjg%netbsd.org@localhost,
 gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost,
 n54%gmx.com@localhost,
 "bsiegert%netbsd.org@localhost" <bsiegert%NetBSD.org@localhost>
Subject: Re: bin/52737 (bmake crash for invalid usage of .PATH)
Date: Tue, 9 Apr 2019 10:32:25 -0700

 I'd rather unconditionally free "paths" if it was not NULL rather than =
 add more complexity
 to the code. This function needs to be split up; it is too big and =
 complicated.
 
 christos
 
 > On Apr 8, 2019, at 4:25 PM, Simon J. Gerraty <sjg%juniper.net@localhost> wrote:
 >=20
 > The following reply was made to PR bin/52737; it has been noted by =
 GNATS.
 >=20
 > From: "Simon J. Gerraty" <sjg%juniper.net@localhost>
 > To: <gnats-bugs%NetBSD.org@localhost>
 > Cc: <gnats-admin%NetBSD.org@localhost>, <netbsd-bugs%NetBSD.org@localhost>, =
 <bsiegert%NetBSD.org@localhost>,
 >        <n54%gmx.com@localhost>, <sjg%juniper.net@localhost>
 > Subject: Re: bin/52737 (bmake crash for invalid usage of .PATH)
 > Date: Mon, 8 Apr 2019 13:35:14 -0700
 >=20
 >> Synopsis: bmake crash for invalid usage of .PATH
 >=20
 > The assert could be removed, or made conditional
 > on seeing valid dependency line:
 >=20
 > diff -r 6f103b9234c3 bmake/parse.c
 > --- a/bmake/parse.c	Sun Dec 30 09:28:02 2018 -0800
 > +++ b/bmake/parse.c	Mon Apr 08 13:33:09 2019 -0700
 > @@ -1222,6 +1222,7 @@
 >      Lst 	    curTargs;	/* list of target names to be found and =
 added
 >  				 * to the targets list */
 >      char	   *lstart =3D line;
 > +    Boolean	    colon_seen;
 >=20
 >      if (DEBUG(PARSE))
 >  	fprintf(debug_file, "ParseDoDependency(%s)\n", line);
 > @@ -1229,6 +1230,7 @@
 >=20
 >      specType =3D Not;
 >      paths =3D NULL;
 > +    colon_seen =3D FALSE;
 >=20
 >      curTargs =3D Lst_Init(FALSE);
 >=20
 > @@ -1313,6 +1315,8 @@
 >=20
 >  	/* Insert a null terminator. */
 >  	savec =3D *cp;
 > +	if (*cp =3D=3D ':')
 > +	    colon_seen =3D TRUE;
 >  	*cp =3D '\0';
 >=20
 >  	/*
 > @@ -1768,6 +1772,10 @@
 >      }
 >=20
 >  out:
 > +    if (paths && !colon_seen) {
 > +	Lst_Destroy(paths, NULL);
 > +	paths =3D NULL;
 > +    }
 >      assert(paths =3D=3D NULL);
 >      if (curTargs)
 >  	    Lst_Destroy(curTargs, NULL);
 >=20
 


Home | Main Index | Thread Index | Old Index