changeset 490:985fe9826996

(re_search_2): Use 0, not -1, as the lower bound for the match position when we adjust RANGE.
author Richard Stallman <rms@gnu.org>
date Sun, 01 Oct 1995 20:17:02 +0000
parents 0874493f99ac
children 6e7f13b83325
files regex.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/regex.c
+++ b/regex.c
@@ -3259,9 +3259,10 @@
     return -1;
     
   /* Fix up RANGE if it might eventually take us outside
-     the virtual concatenation of STRING1 and STRING2.  */
-  if (endpos < -1)
-    range = -1 - startpos;
+     the virtual concatenation of STRING1 and STRING2.
+     Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE.  */ 
+  if (endpos < 0)
+    range = 0 - startpos;
   else if (endpos > total_size)
     range = total_size - startpos;