Do not validate a backreference if the group that it refers to is not valid
This commit is contained in:
@@ -319,7 +319,7 @@ func findAllSubmatchHelper(start *nfaState, str []rune, offset int, numGroups in
|
||||
if currentState.contentContains(str, idx, preferLongest) {
|
||||
nextStates = addStateToList(str, idx+1, nextStates, *currentState.next, currentState.threadGroups, nil, preferLongest)
|
||||
}
|
||||
} else if currentState.isBackreference {
|
||||
} else if currentState.isBackreference && currentState.threadGroups[currentState.referredGroup].IsValid() {
|
||||
groupLength := currentState.threadGroups[currentState.referredGroup].EndIdx - currentState.threadGroups[currentState.referredGroup].StartIdx
|
||||
if currentState.threadBackref == groupLength {
|
||||
currentState.threadBackref = 0
|
||||
|
Reference in New Issue
Block a user