- ::operator_partial should fail for strings if either operand is of zero
  length.
This commit is contained in:
Paul Beckingham 2014-05-27 00:16:40 -04:00
parent 3c72e87d70
commit 1f253f7fc8

View file

@ -764,7 +764,13 @@ bool Variant::operator_partial (const Variant& other) const
// Why the "if" instead of "min"? This is an attempt to eliminate one // Why the "if" instead of "min"? This is an attempt to eliminate one
// std::string::substr call. // std::string::substr call.
int left_length = left._string.length (); int left_length = left._string.length ();
if (left_length == 0)
return false;
int right_length = right._string.length (); int right_length = right._string.length ();
if (right_length == 0)
return false;
if (left_length < right_length) if (left_length < right_length)
return left._string == right._string.substr (0, left_length); return left._string == right._string.substr (0, left_length);
else else