]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
more minor asan fixes
authorChet Ramey <chet.ramey@case.edu>
Mon, 20 Mar 2023 19:23:38 +0000 (15:23 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 20 Mar 2023 19:23:38 +0000 (15:23 -0400)
CWRU/CWRU.chlog
doc/bashref.texi
lib/glob/sm_loop.c
lib/readline/histexpand.c
lib/readline/misc.c

index 54b55a501e47ea11ac5efc654ed336a5c1141112..36fa8ee5c0ce1384f82d395d4f81f1794d567b7b 100644 (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>
index 4d1afa83ffad87bd649c49c2caee40208af82d13..1786ce3730f64d3a822dd161abdaeb9434badf98 100644 (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 = *= /= %= += -= <<= >>= &= ^= |=
index 01910805b71586eeff6842e934cac7f56e809075..303e1f0c51b15bed4261ecd1b73b4f1cb0148df5 100644 (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 */
index 25d962c2cedac0709949616a59ebe14184fe9564..d21240bf4b19342519c33e10597b09b7fd2e7cc3 100644 (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];
        }
index c797ff749c04b652de96e3857f24211baa74ec23..764482a05fb3c9070263f2c1c94d759ab5325d3c 100644 (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? */