bug-bison
[Top][All Lists]
Advanced

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

Segmentation fault using lalr1.cc


From: Tim Van Holder
Subject: Segmentation fault using lalr1.cc
Date: 23 Jan 2003 08:17:17 +0100

When using the lalr1.cc skeleton, CVS bison crashes.  I traced it to
this part of scan-skel.l:

"@output ".*\n {
  char const *filename = yytext + sizeof "@output " - 1;
  yytext[yyleng - 1] = '\0';

  if (*filename == '@')
    {
      if (strcmp (filename, "@output_header_name@") == 0)
        filename = spec_defines_file;
|=>                ^^^^^^^^^^^^^^^^^ this is NULL
      else if (strcmp (filename, "@output_parser_name@") == 0)
        filename = parser_file_name;
      else
        abort ();
|=>     ^^^^^^^^ this is EVIL :-)
    }

  XFREE (outname);
  outname = xstrdup (filename);
|=>         ^^^^^^^ this calls strlen, which crashes due to the NULL arg
  xfclose (yyout);
  yyout = xfopen (outname, "w");
  lineno = 1;
}

-- 
Tim Van Holder <address@hidden>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]