Open Gotr-byte opened 1 year ago
Have a problem replicating this
Type in the following:
unset SHELL SESSION_MANAGER QT_ACCESSIBILITY COLORTERM XDG_CONFIG_DIRS SSH_AGENT_LAUNCHER XDG_MENU_PREFIX TERM_PROGRAM_VERSION GNOME_DESKTOP_SESSION_ID LC_ADDRESS GNOME_SHELL_SESSION_MODE DOTNET_ROOT LC_NAME SSH_AUTH_SOCK XMODIFIERS DESKTOP_SESSION LC_MONETARY GTK_MODULES PWD LOGNAME XDG_SESSION_DESKTOP XDG_SESSION_TYPE SYSTEMD_EXEC_PID XAUTHORITY VSCODE_GIT_ASKPASS_NODE IM_CONFIG_CHECK_ENV GJS_DEBUG_TOPICS HOME USERNAME IM_CONFIG_PHASE LANG LC_PAPER LS_COLORS XDG_CURRENT_DESKTOP WAYLAND_DISPLAY GIT_ASKPASS INVOCATION_ID MANAGERPID DOTNET_BUNDLE_EXTRACT_BASE_DIR CHROME_DESKTOP GJS_DEBUG_OUTPUT VSCODE_GIT_ASKPASS_EXTRA_ARGS GNOME_SETUP_DISPLAY LESSCLOSE XDG_SESSION_CLASS LC_IDENTIFICATION TERM LESSOPEN USER VSCODE_GIT_IPC_HANDLE DISPLAY SHLVL LC_TELEPHONE QT_IM_MODULE LC_MEASUREMENT XDG_RUNTIME_DIR LC_TIME VSCODE_GIT_ASKPASS_MAIN JOURNAL_STREAM XDG_DATA_DIRS GDK_BACKEND PATH GDMSESSION ORIGINAL_XDG_CURRENT_DESKTOP DBUS_SESSION_BUS_ADDRESS GIO_LAUNCHED_DESKTOP_FILE_PID GIO_LAUNCHED_DESKTOP_FILE LC_NUMERIC TERMPROGRAM
unset OLDPWD
export A=hereItWillCrash
The problem occurs when the export is empty. Maybe we can shield the export with an return if empty.
==18762==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x556695994de2 bp 0x7ffdd84d78c0 sp 0x7ffdd84d78a0 T0) ==18762==The signal is caused by a READ memory access. ==18762==Hint: address points to the zero page.
#1 0x556695993c5d in builtins_export src/builtins/export.c:107
#2 0x55669599948d in export_handle src/execute/builtin_handles.c:80
#3 0x5566959966ad in no_fork_handle src/execute/new_fork.c:53
#4 0x556695996c4d in built_in_handler src/execute/new_fork.c:93
#5 0x55669599a2ce in pipe_fork src/execute/execution.c:62
#6 0x55669599a966 in child_process_do src/execute/child_process_do.c:23
#7 0x556695996df5 in execute src/execute/new_fork.c:107
#8 0x556695982cee in parsing_and_execution src/parsing/main.c:94
#9 0x556695983004 in main src/parsing/main.c:121
#10 0x7f4145649d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#11 0x7f4145649e3f in __libc_start_main_impl ../csu/libc-start.c:392
#12 0x556695982624 in _start (/home/piotr/code/mini_v8/minishell+0x4624)
AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV src/builtins/export3.c:76 in sort_indexes ==18762==ABORTING
unset SHELL SESSION_MANAGER QT_ACCESSIBILITY COLORTERM XDG_CONFIG_DIRS SSH_AGENT_LAUNCHER XDG_MENU_PREFIX TERM_PROGRAM_VERSION GNOME_DESKTOP_SESSION_ID LC_ADDRESS GNOME_SHELL_SESSION_MODE DOTNET_ROOT LC_NAME SSH_AUTH_SOCK XMODIFIERS DESKTOP_SESSION LC_MONETARY GTK_MODULES PWD LOGNAME XDG_SESSION_DESKTOP XDG_SESSION_TYPE SYSTEMD_EXEC_PID XAUTHORITY VSCODE_GIT_ASKPASS_NODE IM_CONFIG_CHECK_ENV GJS_DEBUG_TOPICS HOME USERNAME IM_CONFIG_PHASE LANG LC_PAPER LS_COLORS XDG_CURRENT_DESKTOP WAYLAND_DISPLAY GIT_ASKPASS INVOCATION_ID MANAGERPID DOTNET_BUNDLE_EXTRACT_BASE_DIR CHROME_DESKTOP GJS_DEBUG_OUTPUT VSCODE_GIT_ASKPASS_EXTRA_ARGS GNOME_SETUP_DISPLAY LESSCLOSE XDG_SESSION_CLASS LC_IDENTIFICATION TERM LESSOPEN USER VSCODE_GIT_IPC_HANDLE DISPLAY SHLVL LC_TELEPHONE QT_IM_MODULE LC_MEASUREMENT XDG_RUNTIME_DIR LC_TIME VSCODE_GIT_ASKPASS_MAIN JOURNAL_STREAM XDG_DATA_DIRS GDK_BACKEND PATH GDMSESSION ORIGINAL_XDG_CURRENT_DESKTOP DBUS_SESSION_BUS_ADDRESS GIO_LAUNCHED_DESKTOP_FILE_PID GIO_LAUNCHED_DESKTOP_FILE LC_NUMERIC TERMPROGRAM OLDPWD
SHELL SESSION_MANAGER QT_ACCESSIBILITY COLORTERM XDG_CONFIG_DIRS SSH_AGENT_LAUNCHER XDG_MENU_PREFIX TERM_PROGRAM_VERSION GNOME_DESKTOP_SESSION_ID LC_ADDRESS GNOME_SHELL_SESSION_MODE DOTNET_ROOT LC_NAME SSH_AUTH_SOCK XMODIFIERS DESKTOP_SESSION LC_MONETARY GTK_MODULES PWD XDG_SESSION_DESKTOP LOGNAME XDG_SESSION_TYPE SYSTEMD_EXEC_PID XAUTHORITY VSCODE_GIT_ASKPASS_NODE IM_CONFIG_CHECK_ENV GJS_DEBUG_TOPICS HOME USERNAME IM_CONFIG_PHASE LC_PAPER LANG LS_COLORS XDG_CURRENT_DESKTOP WAYLAND_DISPLAY GIT_ASKPASS INVOCATION_ID MANAGERPID DOTNET_BUNDLE_EXTRACT_BASE_DIR CHROME_DESKTOP GJS_DEBUG_OUTPUT VSCODE_GIT_ASKPASS_EXTRA_ARGS GNOME_SETUP_DISPLAY LESSCLOSE XDG_SESSION_CLASS TERM LC_IDENTIFICATION LESSOPEN USER VSCODE_GIT_IPC_HANDLE DISPLAY SHLVL LC_TELEPHONE QT_IM_MODULE LC_MEASUREMENT XDG_RUNTIME_DIR LC_TIME VSCODE_GIT_ASKPASS_MAIN JOURNAL_STREAM XDG_DATA_DIRS GDK_BACKEND PATH GDMSESSION ORIGINAL_XDG_CURRENT_DESKTOP DBUS_SESSION_BUS_ADDRESS GIO_LAUNCHED_DESKTOP_FILE_PID GIO_LAUNCHED_DESKTOP_FILE LC_NUMERIC TERMPROGRAM OLDPWD BiebianOS> env | cut -d '=' -f1 | tr '\n' ' '^C BiebianOS> unset SHELL SESSION_MANAGER QT_ACCESSIBILITY COLORTERM XDG_CONFIG_DIRS SSH_AGENT_LAUNCHER XDG_MENU_PREFIX TERM_PROGRAM_VERSION GNOME_DESKTOP_SESSION_ID LC_ADDRESS GNOME_SHELL_SESSION_MODE DOTNET_ROOT LC_NAME SSH_AUTH_SOCK XMODIFIERS DESKTOP_SESSION LC_MONETARY GTK_MODULES PWD LOGNAME XDG_SESSION_DESKTOP XDG_SESSION_TYPE SYSTEMD_EXEC_PID XAUTHORITY VSCODE_GIT_ASKPASS_NODE IM_CONFIG_CHECK_ENV GJS_DEBUG_TOPICS HOME USERNAME IM_CONFIG_PHASE LANG LC_PAPER LS_COLORS XDG_CURRENT_DESKTOP WAYLAND_DISPLAY GIT_ASKPASS INVOCATION_ID MANAGERPID DOTNET_BUNDLE_EXTRACT_BASE_DIR CHROME_DESKTOP GJS_DEBUG_OUTPUT VSCODE_GIT_ASKPASS_EXTRA_ARGS GNOME_SETUP_DISPLAY LESSCLOSE XDG_SESSION_CLASS LC_IDENTIFICATION TERM LESSOPEN USER VSCODE_GIT_IPC_HANDLE DISPLAY SHLVL LC_TELEPHONE QT_IM_MODULE LC_MEASUREMENT XDG_RUNTIME_DIR LC_TIME VSCODE_GIT_ASKPASS_MAIN JOURNAL_STREAM XDG_DATA_DIRS GDK_BACKEND PATH GDMSESSION ORIGINAL_XDG_CURRENT_DESKTOP DBUS_SESSION_BUS_ADDRESS GIO_LAUNCHED_DESKTOP_FILE_PID GIO_LAUNCHED_DESKTOP_FILE LC_NUMERIC TERMPROGRAM ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [unset] [SHELL] [SESSION_MANAGER] [QT_ACCESSIBILITY] [COLORTERM] [XDG_CONFIG_DIRS] [SSH_AGENT_LAUNCHER] [XDG_MENU_PREFIX] [TERM_PROGRAM_VERSION] [GNOME_DESKTOP_SESSION_ID] [LC_ADDRESS] [GNOME_SHELL_SESSION_MODE] [DOTNET_ROOT] [LC_NAME] [SSH_AUTH_SOCK] [XMODIFIERS] [DESKTOP_SESSION] [LC_MONETARY] [GTK_MODULES] [PWD] [LOGNAME] [XDG_SESSION_DESKTOP] [XDG_SESSION_TYPE] [SYSTEMD_EXEC_PID] [XAUTHORITY] [VSCODE_GIT_ASKPASS_NODE] [IM_CONFIG_CHECK_ENV] [GJS_DEBUG_TOPICS] [HOME] [USERNAME] [IM_CONFIG_PHASE] [LANG] [LC_PAPER] [LS_COLORS] [XDG_CURRENT_DESKTOP] [WAYLAND_DISPLAY] [GIT_ASKPASS] [INVOCATION_ID] [MANAGERPID] [DOTNET_BUNDLE_EXTRACT_BASE_DIR] [CHROME_DESKTOP] [GJS_DEBUG_OUTPUT] [VSCODE_GIT_ASKPASS_EXTRA_ARGS] [GNOME_SETUP_DISPLAY] [LESSCLOSE] [XDG_SESSION_CLASS] [LC_IDENTIFICATION] [TERM] [LESSOPEN] [USER] [VSCODE_GIT_IPC_HANDLE] [DISPLAY] [SHLVL] [LC_TELEPHONE] [QT_IM_MODULE] [LC_MEASUREMENT] [XDG_RUNTIME_DIR] [LC_TIME] [VSCODE_GIT_ASKPASS_MAIN] [JOURNAL_STREAM] [XDG_DATA_DIRS] [GDK_BACKEND] [PATH] [GDMSESSION] [ORIGINAL_XDG_CURRENT_DESKTOP] [DBUS_SESSION_BUS_ADDRESS] [GIO_LAUNCHED_DESKTOP_FILE_PID] [GIO_LAUNCHED_DESKTOP_FILE] [LC_NUMERIC] [TERMPROGRAM] []
BiebianOS> env ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [env]
OLDPWD=/ BiebianOS> unset OLDPWD ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [unset] [OLDPWD]
BiebianOS> env ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [env]
BiebianOS> export something= aa=bb a3420/df=343/34 aa=cc ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [export] [something=] [aa=bb] [a3420/df=343/34] [aa=cc]
AddressSanitizer:DEADLYSIGNAL
==88164==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x55ccaf6a9da8 bp 0x7ffc7f2dec50 sp 0x7ffc7f2dec20 T0) ==88164==The signal is caused by a READ memory access. ==88164==Hint: address points to the zero page.
0 0x55ccaf6a9da8 in inject_to_exp_l src/builtins/export2.c:72
AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV src/builtins/export2.c:72 in inject_to_exp_l ==88164==ABORTING