diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2014-11-12 22:57:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-11-13 16:04:52 (GMT) |
commit | 474bbb9dbcd6c257e68874e6966c145b3b82dbdd (patch) | |
tree | 8ede20f72deac3bf628c81a1e581035a8756364b /Source/cmStringCommand.cxx | |
parent | a9a040e1698a7caf9518c27d3394293e7fe11d59 (diff) | |
download | CMake-474bbb9dbcd6c257e68874e6966c145b3b82dbdd.zip CMake-474bbb9dbcd6c257e68874e6966c145b3b82dbdd.tar.gz CMake-474bbb9dbcd6c257e68874e6966c145b3b82dbdd.tar.bz2 |
string: Tolerate SUBSTRING length exceeding end index
string SUBSTRING command now ignores length if it points
past end of string and uses end of string instead.
String SUBSTRING tests now cover more corner cases.
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r-- | Source/cmStringCommand.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 90a8f85..ce7c854 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -711,12 +711,10 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& this->SetError(ostr.str()); return false; } - int leftOverLength = intStringLength - begin; - if ( end < -1 || end > leftOverLength ) + if ( end < -1 ) { cmOStringStream ostr; - ostr << "end index: " << end << " is out of range -1 - " - << leftOverLength; + ostr << "end index: " << end << " should be -1 or greater"; this->SetError(ostr.str()); return false; } |