Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible crash on invalid input #54

Closed
lexxmark opened this issue Oct 21, 2020 · 3 comments
Closed

Possible crash on invalid input #54

lexxmark opened this issue Oct 21, 2020 · 3 comments

Comments

@lexxmark
Copy link

I'm porting GNU bison on windows and got an issue describing crash on some invalid input file.
lexxmark/winflexbison#64

I reproduced it and stack trace is following:
states_free ()
closure_free()
bitset_free (ruleset);
BITSET_FREE_ (bset); <<<< bset is NULL

Could you check if it also affect original bison code under linux?

@akimd
Copy link
Owner

akimd commented Nov 1, 2020

Hi @lexxmark
First of all, I apologize for the poor delays: I don't get notifications when issues are created, and that's very painful...

If I understand correctly, you are reporting a crash with a pretty old version of Bison (2.5.*), is that right? It might well be true, but the current release is 3.7.3, and with that version:

$ /opt/local/bin/bison /Users/akim/Downloads/rpcalc___win_bison_2.5.23_crash.y
/Users/akim/Downloads/rpcalc___win_bison_2.5.23_crash.y:21.37-22.0: erreur: « " » manquant en fin de fichier
   21 |     | exp '\n'      { printf(%.10g\n", $1); }
      |                                     ^~~~~~~~~
/Users/akim/Downloads/rpcalc___win_bison_2.5.23_crash.y:21.21-86.0: erreur: « } » manquant en fin de fichier
   21 |     | exp '\n'      { printf(%.10g\n", $1); }
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~

Note that the test suite (including the examples) are run with address sanitizer enabled, so it is very unlikely that such a bug would remain unnoticed.

And FWIW, none of 3.0.5, 3.1, 3.2.4, 3.3.2, 3.4.2, 3.5.4, 3.6.4, 3.7.2 crashed. Not even the old 2.7

$ /usr/bin/bison /Users/akim/Downloads/rpcalc___win_bison_2.5.23_crash.y
/Users/akim/Downloads/rpcalc___win_bison_2.5.23_crash.y:10.9-22: syntax error, unexpected identifier, expecting string

Finally, the source code reads:

/* Free bitset BSET.  */
void
bitset_free (bitset bset)
{
  if (bset)
    {
      BITSET_FREE_ (bset);
      free (bset);
    }
}

so I really doubt there is a problem here.

Are you really using something older? There is no support for old Bisons. The only supported version currently is 3.7.3.

Cheers!

@lexxmark
Copy link
Author

lexxmark commented Nov 3, 2020

Thank you for investigation,

If I understand correctly, you are reporting a crash with a pretty old version of Bison (2.5.*), is that right?

No it's winflexbison version 2.5.23 that has flex 2.6.4 and bison 3.7.1

I apologize it seems I use some outdated version of the bitset.c source code:

...
   Copyright (C) 2002-2006, 2009-2015, 2018-2019 Free Software Foundation, Inc.

   Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
...
void
bitset_free (bitset bset)
{
  BITSET_FREE_ (bset);
  free (bset);
}

I will update gnu lib source code from the latest bison release next time I will upgrade winflexbison and this issue in my project should vanish.

Thank you again and sorry for bothering you,
Alex

@lexxmark lexxmark closed this as completed Nov 3, 2020
@akimd
Copy link
Owner

akimd commented Nov 3, 2020

Thank you again and sorry for bothering you

😄 No worries. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants