diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 20cd75cb..4c1b8201 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -5944,3 +5944,28 @@ builtins/times.h - add prototypes for functions taking clock_t and timeval, make their declaration in externs.h conditional on NEED_CLOCK_FUNCS_DECL and NEED_TIMEVAL_FUNCS_DECL, respectively + + 3/31 + ---- +subst.c + - expand_string_dollar_quote: check for zero-length return from + string_extract_{single,double}_quoted and avoid size_t underflow + Fixes asan error reported by Grisha Levit + + 4/3 + --- +builtins/evalstring.c + - open_redir_file: treat the case of failing to open the file as a + non-fatal expansion error instead of a (fatal) redirection error. + Report from Zev Weiss + + 4/4 + --- +lib/readline/vi_mode.c + - _rl_domove_motion_cleanup: d/D require the same special case as c/C + so that a motion command that doesn't move the cursor consumes/deletes + at least one character. + From Emanuele Torre + - _rl_domove_motion_cleanup: ditto for y/Y + - rl_domove_motion_callback: if t/T/;/, fail (return non-zero without + moving point), flag the motion command as having failed (MOVE_FAILED) diff --git a/CWRU/misc/open-files.c b/CWRU/misc/open-files.c index 6a555776..67440de4 100644 --- a/CWRU/misc/open-files.c +++ b/CWRU/misc/open-files.c @@ -27,6 +27,7 @@ #include +int main() { register int i; diff --git a/builtins/evalstring.c b/builtins/evalstring.c index 554ebc48..b78b53e9 100644 --- a/builtins/evalstring.c +++ b/builtins/evalstring.c @@ -756,7 +756,7 @@ open_redir_file (REDIRECT *r, char **fnp) fd = open(fn, O_RDONLY); if (fd < 0) { - file_error (fn); + internal_error ("%s: %s", fn, strerror (errno)); free (fn); if (fnp) *fnp = 0; diff --git a/lib/readline/vi_mode.c b/lib/readline/vi_mode.c index e85fd101..7396e316 100644 --- a/lib/readline/vi_mode.c +++ b/lib/readline/vi_mode.c @@ -1153,6 +1153,23 @@ _rl_mvcxt_dispose (_rl_vimotion_cxt *m) xfree (m); } +static inline int +vi_charsearch_command (int c) +{ + switch (c) + { + case 'f': + case 'F': + case 't': + case 'T': + case ';': + case ',': + return 1; + default: + return 0; + } +} + static int rl_domove_motion_callback (_rl_vimotion_cxt *m) { @@ -1173,7 +1190,7 @@ rl_domove_motion_callback (_rl_vimotion_cxt *m) /* Note in the context that the motion command failed. Right now we only do this for unsuccessful searches (ones where _rl_dispatch returns non-zero and point doesn't move). */ - if (r != 0 && rl_point == opoint && (c == 'f' || c == 'F')) + if (r != 0 && rl_point == opoint && vi_charsearch_command (c)) m->flags |= MOVE_FAILED; #if defined (READLINE_CALLBACKS) @@ -1211,6 +1228,14 @@ _rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m) didn't delete anything, as long as the motion command is valid. */ if (_rl_to_upper (m->key) == 'C' && _rl_vi_motion_command (c) && (m->flags & MOVE_FAILED) == 0) return (vidomove_dispatch (m)); + /* 'd' and 'D' must delete at least one character even if the motion + command doesn't move the cursor. */ + if (_rl_to_upper (m->key) == 'D' && _rl_vi_motion_command (c) && (m->flags & MOVE_FAILED) == 0) + return (vidomove_dispatch (m)); + /* 'y' and 'Y' must yank at least one character even if the motion + command doean't move the cursor. */ + if (_rl_to_upper (m->key) == 'Y' && _rl_vi_motion_command (c) && (m->flags & MOVE_FAILED) == 0) + return (vidomove_dispatch (m)); RL_UNSETSTATE (RL_STATE_VIMOTION); return (-1); } diff --git a/lib/sh/oslib.c b/lib/sh/oslib.c index ab7924df..85f7b491 100644 --- a/lib/sh/oslib.c +++ b/lib/sh/oslib.c @@ -161,7 +161,7 @@ getdtablesize (void) # undef bcopy # endif void -bcopy (void *s, *d, size_t n) +bcopy (void *s, void *d, size_t n) { FASTCOPY (s, d, n); } diff --git a/subst.c b/subst.c index 3c16749c..555d18db 100644 --- a/subst.c +++ b/subst.c @@ -4063,7 +4063,7 @@ char * expand_string_dollar_quote (const char *string, int flags) { size_t slen, retind, retsize; - int sindex, c, peekc, news; + int sindex, c, peekc, news, tlen; char *ret, *trans, *t; size_t translen; const char *send; @@ -4100,7 +4100,7 @@ expand_string_dollar_quote (const char *string, int flags) news = skip_single_quoted (string, slen, ++sindex, SX_COMPLETE); else news = skip_double_quoted (string, slen, ++sindex, SX_COMPLETE); - translen = news - sindex - 1; + translen = (news > sindex) ? news - sindex - 1 : 0; RESIZE_MALLOCED_BUFFER (ret, retind, translen + 3, retsize, 64); ret[retind++] = c; if (translen > 0)