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

cmd/lex fix Segmentation fault #691

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Hojun-Cho
Copy link

@Hojun-Cho Hojun-Cho commented Dec 27, 2024

If the file does not end with new line, segmentation fault occurs.
Because input file is already closed.

// input.l
%{
%}
%%
[0-9]+          return NUMBER;
%%
#0  0x000055555555c8e0 in Bgetc (bp=0x0) at bgetc.c:10
#1  0x000055555555986c in gch () at sub1.c:277
#2  0x0000555555559960 in getl (p=p@entry=0x55555556a6a0 <buf> "%%") at sub1.c:10
#3  0x0000555555556f9a in yylex ()
    at /home/xxxx/src/plan9port/src/cmd/lex/parser.y:623
#4  0x00005555555581b9 in yylex1 ()
    at /home/xxxx/src/plan9port/src/cmd/lex/parser.y:823
#5  0x0000555555558515 in yyparse ()
    at /home/xxxx/src/plan9port/src/cmd/lex/parser.y:951
#6  0x00005555555567c3 in p9main (argc=1, argv=0x7fffffffe090) at lmain.c:149
#7  0x0000555555556359 in main (argc=<optimized out>, argv=<optimized out>)

@Hojun-Cho Hojun-Cho changed the title lex/parser.y fix Segmentation fault cmd/lex fix Segmentation fault Dec 27, 2024
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

Successfully merging this pull request may close these issues.

1 participant