mirror of
https://github.com/dvorka/hstr.git
synced 2024-12-26 09:22:13 +08:00
5ab8205859
This patch fixes a segfault when .zsh_history contains commands starting with `:` and longer than 15 characters long. Considering the history line: : 1592444398:0;:vspman epoll_ctl The ranked item's line will be: :vspman epoll_ctl When building the prioritized history, we used to apply the zsh extended history offset if the line starts with `:` (and if the command is longer than `15`, defined by `ZSH_HISTORY_ITEM_OFFSET`), which then makes the item point to: tl This makes the `r->item` pointer invalid, which causes the segfault observed in #408 within `prioritized_history_destroy`. --- This patch prevents the same issue from arising again (even if the line is wrongly interpreted) since it avoids any pointer arithmetic between assignment and freeing. Additionally, the patch also greatly improves the heuristics used in determining whether a line is of extended history format or not, since the non-extended format is also supported by zsh. --- Fix #410 Fix #399 |
||
---|---|---|
.. | ||
resources | ||
src | ||
unity/src | ||
.gitignore | ||
hstr-unit-tests.pro | ||
test-bug-124.sh | ||
test-bug-163.sh | ||
test-bug-175.sh | ||
test-bug-176.sh | ||
test-bug-228.sh | ||
test-curses-keyb.sh | ||
test-history-generator.sh | ||
test-keyb.sh | ||
test-utf8.sh |