# HG changeset patch # User Richard M. Stallman # Date 812578622 0 # Node ID 4f0f50fc3aafca2549bdc3e449dd70748a11c57d # Parent 5ab611596c38a8d178ee173239f86a31a2e9cda5 (re_search_2): Use 0, not -1, as the lower bound for the match position when we adjust RANGE. diff -r 5ab611596c38 -r 4f0f50fc3aaf src/regex.c --- a/src/regex.c Sun Oct 01 20:00:22 1995 +0000 +++ b/src/regex.c Sun Oct 01 20:17:02 1995 +0000 @@ -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;