Fixed RegExp bugs #105972 & #87231. r=khanson, sr=brendan.

This commit is contained in:
rogerl%netscape.com 2002-01-16 06:06:34 +00:00
Родитель 506ca13a9a
Коммит 08c2912aac
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -1805,6 +1805,9 @@ static const jschar *matchRENodes(MatchState *state, RENode *ren, RENode *stop,
kidMatch = matchRENodes(state, (RENode *)ren->kid, kidMatch = matchRENodes(state, (RENode *)ren->kid,
ren->next, cp); ren->next, cp);
if (kidMatch == NULL) { if (kidMatch == NULL) {
/* need to undo the result of running the kid */
for (i = num; i < state->parenCount; i++)
state->parens[i].length = 0;
state->parenCount = num; state->parenCount = num;
break; break;
} }
@ -1813,6 +1816,8 @@ static const jschar *matchRENodes(MatchState *state, RENode *ren, RENode *stop,
stop, kidMatch); stop, kidMatch);
if (restMatch == NULL) { if (restMatch == NULL) {
/* need to undo the result of running the kid */ /* need to undo the result of running the kid */
for (i = num; i < state->parenCount; i++)
state->parens[i].length = 0;
state->parenCount = num; state->parenCount = num;
break; break;
} }
@ -1905,11 +1910,11 @@ static const jschar *matchRENodes(MatchState *state, RENode *ren, RENode *stop,
return NULL; return NULL;
break; break;
case REOP_DOTSTARMIN: case REOP_DOTSTARMIN:
for (cp2 = cp; cp2 < cpend; cp2++) { for (cp2 = cp; cp2 <= cpend; cp2++) {
const jschar *cp3 = matchRENodes(state, ren->next, stop, cp2); const jschar *cp3 = matchRENodes(state, ren->next, stop, cp2);
if (cp3 != NULL) if (cp3 != NULL)
return cp3; return cp3;
if (IS_LINE_TERMINATOR(*cp2)) if ((cp2 == cpend) || IS_LINE_TERMINATOR(*cp2))
return NULL; return NULL;
} }
return NULL; return NULL;