more minor asan fixes

This commit is contained in:
Chet Ramey
2023-03-20 15:23:38 -04:00
parent deedd41cf4
commit 4c2b574c00
5 changed files with 30 additions and 5 deletions
+18
View File
@@ -5707,3 +5707,21 @@ parse.y
- read_token: if we return a newline, make sure we call set_word_top()
if necessary.
Fixes underflow reported by Grisha Levit <grishalevit@gmail.com>
lib/glob/sm_loop.c
- EXTMATCH: don't bother with FNM_PATHNAME checks; this function isn't
called with a pathname.
Fixes underflow reported by Grisha Levit <grishalevit@gmail.com>
lib/readline/misc.c
- rl_maybe_replace_line: if we replace a history entry's data with
rl_undo_list, we need to set rl_undo_list to 0, since we should not
have rl_undo_list pointing to something from a history entry
Fixes asan error reported by Grisha Levit <grishalevit@gmail.com>
3/20
----
lib/readline/histexpand.c
- postproc_subst_rhs: fix off-by-one error when reallocating new string
for case where we're *not* substituting for `&'
Fixes asan error reported by Grisha Levit <grishalevit@gmail.com>
+6 -1
View File
@@ -7528,6 +7528,11 @@ equal-precedence operators.
The levels are listed in order of decreasing precedence.
@table @code
@cindex arithmetic operators
@cindex unary arithmetic operators
@cindex binary arithmetic operators
@cindex conditional arithmetic operator
@cindex bitwise arithmetic operators
@item @var{id}++ @var{id}--
variable post-increment and post-decrement
@@ -7574,7 +7579,7 @@ logical AND
@item ||
logical OR
@item expr ? expr : expr
@item expr ? if-true-expr : if-false-expr
conditional operator
@item = *= /= %= += -= <<= >>= &= ^= |=
+1 -3
View File
@@ -907,9 +907,7 @@ fprintf(stderr, "extmatch: flags = %d\n", flags);
if (m1 == 0 && (flags & FNM_PERIOD) && *s == '.')
return (FNM_NOMATCH);
if (m1 == 0 && (flags & FNM_DOTDOT) &&
(SDOT_OR_DOTDOT (s) ||
((flags & FNM_PATHNAME) && s[-1] == L('/') && PDOT_OR_DOTDOT(s))))
if (m1 == 0 && (flags & FNM_DOTDOT) && (SDOT_OR_DOTDOT (s)))
return (FNM_NOMATCH);
/* if srest > s, we are not at start of string */
+1 -1
View File
@@ -509,7 +509,7 @@ postproc_subst_rhs (void)
/* a single backslash protects the `&' from lhs interpolation */
if (subst_rhs[i] == '\\' && subst_rhs[i + 1] == '&')
i++;
if (j >= new_size)
if (j + 1 >= new_size)
new = (char *)xrealloc (new, new_size *= 2);
new[j++] = subst_rhs[i];
}
+4
View File
@@ -340,6 +340,10 @@ rl_maybe_replace_line (void)
xfree (temp->line);
FREE (temp->timestamp);
xfree (temp);
/* Do we want to set rl_undo_list = 0 here since we just saved it into
a history entry? */
rl_undo_list = 0;
/* XXX - what about _rl_saved_line_for_history? if the saved undo list
is rl_undo_list, and we just put that into a history entry, should
we set the saved undo list to NULL? */