asan fuzzing fixes; fix incomplete multibyte chars in history expansion; new nosort GLOBSORT value

This commit is contained in:
Chet Ramey
2023-05-01 09:59:55 -04:00
parent 7aae19bfe4
commit 23935dbe85
9 changed files with 95 additions and 41 deletions
+1 -1
View File
@@ -1121,7 +1121,7 @@ history_expand (const char *hstring, char **output)
c = tchar;
memset (mb, 0, sizeof (mb));
for (k = 0; k < MB_LEN_MAX; k++)
for (k = 0; k < MB_LEN_MAX && i < l; k++)
{
mb[k] = (char)c;
memset (&ps, 0, sizeof (mbstate_t));
+4
View File
@@ -307,6 +307,10 @@ void
_rl_start_using_history (void)
{
using_history ();
#if 1
if (_rl_saved_line_for_history && _rl_saved_line_for_history->data)
_rl_free_undo_list ((UNDO_LIST *)_rl_saved_line_for_history->data);
#endif
_rl_free_saved_history_line ();
_rl_history_search_pos = -99; /* some random invalid history position */
}
+3 -1
View File
@@ -983,6 +983,9 @@ rl_insert (int count, int c)
break;
}
/* If we didn't insert n and there are pending bytes, we need to insert
them if _rl_insert_char didn't do that on its own. */
if (n != (unsigned short)-2) /* -2 = sentinel value for having inserted N */
{
/* setting rl_pending_input inhibits setting rl_last_func so we do it
@@ -992,7 +995,6 @@ rl_insert (int count, int c)
rl_executing_keyseq[rl_key_sequence_length = 0] = '\0';
r = rl_execute_next (n);
}
return r;
}