bin/190100: make core dump at syntax error

Petr Lampa lampa at fit.vutbr.cz
Thu May 22 10:10:00 UTC 2014


>Number:         190100
>Category:       bin
>Synopsis:       make core dump at syntax error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 22 10:10:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Petr Lampa
>Release:        9.2-STABLE
>Organization:
BUT FIT
>Environment:
FreeBSD xxx 9.3-PRERELEASE FreeBSD 9.3-PRERELEASE #1 r266496: Wed May 21 17:47:04 CEST 2014     xxxx:/usr/obj/usr/src/sys/xxx amd64

>Description:
make core dumps with this invalid Makefile (notice two && operators):

OSVERSION=901500
. if ${OSVERSION} >= 901500 && && (${ARCH} == i386 || ${ARCH} == amd64)
. endif

(gdb) where
#0  0x0000000000448d8c in kill ()
#1  0x0000000000447bd8 in abort ()
#2  0x0000000000403197 in Cond_If (
    line=0x80085de05 "${OSVERSION} >= 901500 && && (${ARCH} == i386 || ${ARCH} == amd64)", code=<value optimized out>, lineno=2)
    at /usr/src/usr.bin/make/cond.c:1079
#3  0x000000000040d64c in Parse_File (name=<value optimized out>,
    stream=<value optimized out>) at /usr/src/usr.bin/make/parse.c:2366
#4  0x000000000040a274 in ReadMakefile (p=<value optimized out>)
    at /usr/src/usr.bin/make/main.c:323
#5  0x000000000040a328 in TryReadMakefile (p=0x80081a1b0 "Makefile")
    at /usr/src/usr.bin/make/main.c:342
#6  0x000000000040a879 in main (argc=3, argv=0x7fffffffea90)
    at /usr/src/usr.bin/make/main.c:1185

It seems that current token from CondE(TRUE) is And and this is not handled correctly in switch() at line 1061. Perhaps any unexpected token can be here?
>How-To-Repeat:

>Fix:
remove default: block and change case Err: to default:

      switch (CondE(TRUE)) {
          case True:
                if (CondToken(TRUE) != EndOfFile)
                        goto err;
                value = TRUE;
                break;

          case False:
                if (CondToken(TRUE) != EndOfFile)
                        goto err;
                value = FALSE;
                break;

          default:
  err:          Parse_Error(PARSE_FATAL, "Malformed conditional (%s)", line);
                return;

        }

With this change it correctly reports:

"Makefile", line 2: Malformed conditional ...



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list