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

program crashes on favorite add #470

Open
juppytt opened this issue Dec 5, 2022 · 2 comments
Open

program crashes on favorite add #470

juppytt opened this issue Dec 5, 2022 · 2 comments
Assignees

Comments

@juppytt
Copy link
Contributor

juppytt commented Dec 5, 2022

  1. Prepare a zsh history file (~/.zsh_history) that contains an entry such as vim ~/.zsh_history
  2. Run hstr by ./src/hstr AAAAAA
  3. Add a new favorite from history (Ctrl-J then Ctrl-F)
  4. Clear the command buffer and search the entry from history (Ctrl-U, Z, Ctrl-J) => this searches vim ~/.zsh_history and selects the entry
  5. Invalidate search result by changing to exact match and favorites view (Ctrl-E, Ctrl-Slash, Ctrl-Slash)
  6. There is no matching entry but try to select an empty entry and add it to the favorite (Ctrl-J then Ctrl-F)
  7. Crashes on accessing a null pointer

poc

Stopped reason: SIGSEGV
0x00007ffff7ce8891 in ?? () from /usr/lib/x86_64-linux-gnu/libc.so.6
gdb-peda$ bt
#0  0x00007ffff7ce8891 in ?? () from /usr/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7c0100a in strcasestr () from /usr/lib/x86_64-linux-gnu/libc.so.6
#2  0x00005555555ff3f1 in __interceptor_strcasestr (s1=s1@entry=0x0, s2=0x7ffff5900030 "B")
    at /home/juhee/project/foxfuzz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:688
#3  0x0000555555678615 in hstr_make_selection (prefix=<optimized out>, history=<optimized out>, maxSelectionCount=0x39) at hstr.c:935
#4  0x0000555555679605 in hstr_print_selection (maxHistoryItems=<optimized out>, pattern=<optimized out>) at hstr.c:1066
#5  0x000055555567be9c in loop_to_select () at hstr.c:1403
#6  0x000055555567d6fa in hstr_interactive () at hstr.c:1660
#7  0x000055555567dcce in hstr_main (argc=0x2, argv=0x7fffffffe058) at hstr.c:1744
#8  0x00007ffff7b84083 in __libc_start_main () from /usr/lib/x86_64-linux-gnu/libc.so.6
#9  0x000055555557559e in _start ()

File: ~/.zsh_history

1670224747:0;vim ~/.zsh_history
@juppytt juppytt changed the title program crashes on hstr_make_selection() program crashes on favorite add Dec 5, 2022
@dvorka dvorka self-assigned this Dec 7, 2022
@dvorka
Copy link
Owner

dvorka commented Dec 7, 2022

Thank you @juppytt!

@dvorka
Copy link
Owner

dvorka commented Jan 23, 2023

#471

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

No branches or pull requests

2 participants