- 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 <grishalevit@gmail.com>
+
+ 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 <zev@bewilderbeest.net>
+
+ 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 <torreemanuele6@gmail.com>
+ - _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)
#include <stdio.h>
+int
main()
{
register int i;
fd = open(fn, O_RDONLY);
if (fd < 0)
{
- file_error (fn);
+ internal_error ("%s: %s", fn, strerror (errno));
free (fn);
if (fnp)
*fnp = 0;
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)
{
/* 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)
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);
}
# undef bcopy
# endif
void
-bcopy (void *s, *d, size_t n)
+bcopy (void *s, void *d, size_t n)
{
FASTCOPY (s, d, n);
}
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;
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)