Limit the number of expanded optional parts in DSL to at most 32 to prevent resource exhaustion.

This commit is contained in:
Konstantin Isakov 2010-09-28 21:55:53 -07:00
parent 7778a8562a
commit 014731fa85

View file

@ -930,7 +930,11 @@ void expandOptionalParts( wstring & str, list< wstring > & result,
wstring removed( str, 0, x ); wstring removed( str, 0, x );
// Limit the amount of results to avoid excessive resource consumption
if ( result.size() < 32 )
result.push_back( removed ); result.push_back( removed );
else
return;
} }
} }
@ -949,6 +953,8 @@ void expandOptionalParts( wstring & str, list< wstring > & result,
++x; ++x;
} }
// Limit the amount of results to avoid excessive resource consumption
if ( result.size() < 32 )
result.push_back( str ); result.push_back( str );
} }