Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions stl/inc/regex
Original file line number Diff line number Diff line change
Expand Up @@ -3931,23 +3931,22 @@ _BidIt _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Skip(_BidIt _First_arg, _BidIt
break;

case _N_if:
{ // check for soonest string match
{
// GH-5452: If this node has two or more branches,
// examining all these branches has quadratic worst-case complexity.
// Thus, we only continue if this node has a single branch only.
_Node_if* _Node = static_cast<_Node_if*>(_Nx);

for (; _First_arg != _Last && _Node; _Node = _Node->_Child) {
_Last = _Skip(_First_arg, _Last, _Node->_Next);
if (_Node->_Child != nullptr) {
return _First_arg;
}

return _Last;
break;
}

case _N_begin:
break;

case _N_end:
_Nx = nullptr;
break;

case _N_none:
case _N_wbound:
case _N_dot:
Expand Down