LukasKava / Minishell

0 stars 0 forks source link

crash log #80

Closed Gotr-byte closed 1 year ago

Gotr-byte commented 1 year ago

piotr@piotr-Lenovo-G50-80:~/code/miniv8$ ./minishell Juno> export $USERNAME=BOB ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [export] [piotr=BOB]

Juno> echo $USERNAME ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [piotr]

piotr Juno> unset USERNAME ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [unset] [USERNAME]

Juno> echo $USERNAME Envvar does not excist! ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] []

Juno> export USERNAME=Bob ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [export] [USERNAME=Bob]

Juno> echo $USERNAME ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [Bob]

Bob Juno> /bin/ls ____CHUNK LIST_____ full listC: indentifier: 20: /bin/ls ARGUMENTS: [/bin/ls]

env.txt makefile norm.txt export.txt minishell README.md includes minishell.dSYM src libft norminette.txt Juno> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

Juno> /bin/ls ____CHUNK LIST_____ full listC: indentifier: 20: /bin/ls ARGUMENTS: [/bin/ls]

archive export.txt miniv8 sr srcs Juno> cd .. ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

Juno> /bin/ls ____CHUNK LIST_____ full listC: indentifier: 20: /bin/ls ARGUMENTS: [/bin/ls]

111.txt ambassadorship.txt code Desktop Documents Downloads fi fi.txt inf Music newfile.txt Pictures Public snap teams_1.3.00.5153_amd64.deb Templates Videos Juno> cd P Pictures/ Public/
Juno> cd P Pictures/ Public/
Juno> cd .azure/ .bash_history .bash_logout .bashrc .bashrc.bak .cache/ .config/ .dotnet/ .gitconfig .gnupg/ .lesshst .local/ .net/ .npm/ .nuget/ .pki/ .profile --More-- ^C

==45984==ERROR: AddressSanitizer: heap-use-after-free on address 0x6020000089f0 at pc 0x7f456b70034f bp 0x7ffc0f570c30 sp 0x7ffc0f5703d8 READ of size 2 at 0x6020000089f0 thread T0

0 0x7f456b70034e in __interceptor_strrchr ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:740

#1 0x7f456b68313e  (/lib/x86_64-linux-gnu/libreadline.so.8+0x1513e)
#2 0x7f456b68dfbf in rl_display_match_list (/lib/x86_64-linux-gnu/libreadline.so.8+0x1ffbf)
#3 0x7f456b68e327  (/lib/x86_64-linux-gnu/libreadline.so.8+0x20327)
#4 0x7f456b68e636 in rl_complete_internal (/lib/x86_64-linux-gnu/libreadline.so.8+0x20636)
#5 0x7f456b685e97 in _rl_dispatch_subseq (/lib/x86_64-linux-gnu/libreadline.so.8+0x17e97)
#6 0x7f456b686cc9 in readline_internal_char (/lib/x86_64-linux-gnu/libreadline.so.8+0x18cc9)
#7 0x7f456b68fd14 in readline (/lib/x86_64-linux-gnu/libreadline.so.8+0x21d14)
#8 0x55e3f9ee6ef3 in main src/parsing/main.c:116
#9 0x7f456b46fd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#10 0x7f456b46fe3f in __libc_start_main_impl ../csu/libc-start.c:392
#11 0x55e3f9ee6624 in _start (/home/piotr/code/mini_v8/minishell+0x4624)

0x6020000089f0 is located 0 bytes inside of 5-byte region [0x6020000089f0,0x6020000089f5) freed by thread T0 here:

0 0x7f456b776517 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127

#1 0x7f456b684a04 in _rl_free_match_list (/lib/x86_64-linux-gnu/libreadline.so.8+0x16a04)

previously allocated by thread T0 here:

0 0x7f456b776867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x7f456b6a7bac in xmalloc (/lib/x86_64-linux-gnu/libreadline.so.8+0x39bac)

SUMMARY: AddressSanitizer: heap-use-after-free ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:740 in __interceptor_strrchr Shadow bytes around the buggy address: 0x0c047fff90e0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff90f0: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fd 0x0c047fff9100: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff9110: fa fa fd fa fa fa 04 fa fa fa fd fa fa fa fd fa 0x0c047fff9120: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa =>0x0c047fff9130: fa fa fd fa fa fa fd fa fa fa fd fd fa fa[fd]fa 0x0c047fff9140: fa fa fd fd fa fa fd fa fa fa fd fa fa fa fd fd 0x0c047fff9150: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fa 0x0c047fff9160: fa fa fd fd fa fa fd fd fa fa fd fa fa fa fd fd 0x0c047fff9170: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fa 0x0c047fff9180: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==45984==ABORTING

Gotr-byte commented 1 year ago

Changed $USERNAME to Bob using unset and export, then I did a bunch of cd's and ls's.