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

MS crashing when trying to execute here-doc #17

Closed
tesla33io opened this issue Jul 26, 2024 · 0 comments
Closed

MS crashing when trying to execute here-doc #17

tesla33io opened this issue Jul 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@tesla33io
Copy link
Owner

tesla33io commented Jul 26, 2024

Trying to run here-doc in minshell causes it to crash. The issue is in parsing, namely - when trying to print error with data from token_stream which is null at that point (after multiple recursive calls).

Logs from core file and gdb:

#0  0x0000572872e87e65 in ft_parse (shell_data=0x57287477c2a0, production=0x5728747bc7e0 "", parent=0x5728747bc5a0, token_stream=0x0) at src/parser/parser.c:83
#1  0x0000572872e87efd in ft_parse (shell_data=0x57287477c2a0, production=0x5728747bb8c0 "", parent=0x5728747bc5a0, token_stream=0x5728747a2970) at src/parser/parser.c:94
#2  0x0000572872e87efd in ft_parse (shell_data=0x57287477c2a0, production=0x5728747bb550 "", parent=0x57287477cf90, token_stream=0x5728747a2970) at src/parser/parser.c:94
#3  0x0000572872e87efd in ft_parse (shell_data=0x57287477c2a0, production=0x5728747a28a0 "", parent=0x57287477cf90, token_stream=0x5728747a2970) at src/parser/parser.c:94
#4  0x0000572872e87efd in ft_parse (shell_data=0x57287477c2a0, production=0x5728747babe0 "", parent=0x57287477cf90, token_stream=0x5728747a2970) at src/parser/parser.c:94
#5  0x0000572872e86b91 in main (ac=1, av=0x7ffe312811f8, envp=0x7ffe31281208) at src/main.c:31
(gdb) info locals
alternative = 0x0
symbol = 0x5728747bc7e0 ""

Tried to change check for null in this function:

src/parser/parser.c:71
-if (!token_stream && !production && !shell_data->lexer->unmatched)
+if (!token_stream || !production || !shell_data->lexer->unmatched)

It didn't fixed the problem, but prevented MS from crashing.

@tesla33io tesla33io added the bug Something isn't working label Jul 26, 2024
tesla33io added a commit that referenced this issue Jul 31, 2024
- doesn't work with more than one heredoc

Refs: #17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants