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

Unescaped reserved symbols in some expressions cause segfault #154

Open
dhdaines opened this issue Apr 1, 2024 · 0 comments
Open

Unescaped reserved symbols in some expressions cause segfault #154

dhdaines opened this issue Apr 1, 2024 · 0 comments

Comments

@dhdaines
Copy link

dhdaines commented Apr 1, 2024

This will cause foma to segfault:

define foo_bar u -> oo;
define baz a -> e;
define grammar foo_bar .o. baz;
regex grammar;

Fair enough, _ is a reserved symbol, so it needs to be escaped. Better not to use underscores in network names :) but it probably shouldn't cause a segmentation fault. Backtrace looks like this:

Program received signal SIGSEGV, Segmentation fault.
0x000055555558c65a in fsm_isempty (net=0x0) at /home/dhd/work/flair/src/foma/foma/structures.c:330
330         struct fsm_state *fsm = minimal->states;
(gdb) bt
#0  0x000055555558c65a in fsm_isempty (net=0x0) at /home/dhd/work/flair/src/foma/foma/structures.c:330
#1  0x000055555556ea24 in fsm_compose (net1=0x0, net2=0x555556e14ec0) at /home/dhd/work/flair/src/foma/foma/constructions.c:558
#2  0x00005555555a0261 in yyparse (scanner=0x555556e0bc10, defined_nets=0x555556e052e0, defined_funcs=0x555556e05300) at /home/dhd/work/flair/src/foma/foma/regex.y:261
#3  0x000055555558ff59 in my_yyparse (my_string=0x555556e05549 " foo_bar .o. baz;", lineno=3, defined_nets=0x555556e052e0, defined_funcs=0x555556e05300)
    at /home/dhd/work/flair/src/foma/foma/regex.l:130
#4  0x0000555555564ab1 in interfacelex () at /home/dhd/work/flair/src/foma/foma/interface.l:356
#5  0x0000555555560606 in my_interfaceparse (my_string=0x555556e06520 "define foo_bar u -> oo;\ndefine baz a -> e;\ndefine grammar foo_bar .o. baz;\nregex grammar;")
    at /home/dhd/work/flair/src/foma/foma/interface.l:109
#6  0x000055555555ab12 in main (argc=3, argv=0x7fffffffdfc8) at /home/dhd/work/flair/src/foma/foma/foma.c:129
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

1 participant