tests: add simple reproducer for cmdlist use-after-free

This commit is contained in:
Khaïs COLIN 2025-02-26 14:07:55 +01:00 committed by Khaïs COLIN
parent d303f22b73
commit ccbd89708f
2 changed files with 26 additions and 0 deletions

View file

@ -2,6 +2,7 @@
# file are prefixed with test_
rawtests = \
quote_removal \
cmdlist_use_after_free \
metacharacters \
parse_command_lists \
parse_pipelines \

View file

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cmdlist_use_after_free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/03 11:40:37 by khais #+# #+# */
/* Updated: 2025/03/03 13:09:12 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#include "../src/parser/wordsplit/wordsplit.h"
#include "../src/parser/command_list/command_list.h"
#include "libft.h"
#include <assert.h>
int main(void)
{
t_wordlist *words = minishell_wordsplit("|");
ft_printf("FINISHED PARSING WORDS!\n");
t_cmdlist *cmd = cmdlist_from_wordlist(words);
assert(cmd == NULL);
return (0);
}