mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-02-19 07:55:01 +00:00
- Fixes crash that can occur when programs call `readline`'s `rl_redisplay()` function
Backtrace in `megacmd`:
```
rkirkman@termux.dev:/$ ls
rkirkman@termux.dev:/$
Thread 1 "mega-cmd" received signal SIGSEGV, Segmentation fault.
0x0000007fbe1d2218 in ?? () from /data/data/com.termux/files/usr/lib/libreadline.so.8.3
(gdb) bt
at /home/builder/.termux-build/megacmd/src/src/megacmdshell/megacmdshell.cpp:1752
at /home/builder/.termux-build/megacmd/src/src/megacmdshell/megacmdshell.cpp:2080
```
- Copied and pasted from c27f6349cc/8.3.0-display-null-prompt.patch
12 lines
613 B
Diff
12 lines
613 B
Diff
--- a/display.c
|
|
+++ b/display.c
|
|
@@ -783,7 +783,7 @@ _rl_optimize_redisplay (void)
|
|
|
|
/* Useful shorthand used by rl_redisplay, update_line, rl_move_cursor_relative */
|
|
#define INVIS_FIRST() (local_prompt_invis_chars[0])
|
|
-#define WRAP_OFFSET(line, offset) ((line <= prompt_last_screen_line) ? local_prompt_invis_chars[line] : 0)
|
|
+#define WRAP_OFFSET(line, offset) ((line <= prompt_last_screen_line && local_prompt_invis_chars) ? local_prompt_invis_chars[line] : 0)
|
|
|
|
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
|
|
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
|