summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-10-01 20:17:02 +0000
committerRichard M. Stallman <rms@gnu.org>1995-10-01 20:17:02 +0000
commit34597fa95179c81c9b8863052c9efff9602a51e1 (patch)
treeb46c5cde9b15fb6097a36ecde583bcfd76ccb99d /src/regex.c
parent5cabce210eeb1311146ceaa967c20f9ec5b94dd7 (diff)
downloademacs-34597fa95179c81c9b8863052c9efff9602a51e1.tar.gz
emacs-34597fa95179c81c9b8863052c9efff9602a51e1.tar.bz2
emacs-34597fa95179c81c9b8863052c9efff9602a51e1.zip
(re_search_2): Use 0, not -1, as the lower bound
for the match position when we adjust RANGE.
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/regex.c b/src/regex.c
index d0086ed1aad..8b26a737559 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -3259,9 +3259,10 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
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;