diff options
author | nyamatongwe <unknown> | 2004-04-12 05:43:00 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2004-04-12 05:43:00 +0000 |
commit | 2443e8c2a5d7bd638edd04ee8fe06d0294a4f7d3 (patch) | |
tree | 771c0e3ea7f76e8529a22b689e704b0bd7fc27b3 /src | |
parent | 2ed8637999029074e02c0652068e347841acd671 (diff) | |
download | scintilla-mirror-2443e8c2a5d7bd638edd04ee8fe06d0294a4f7d3.tar.gz |
Extra argument validation from Philippe.
Diffstat (limited to 'src')
-rw-r--r-- | src/PropSet.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/PropSet.cxx b/src/PropSet.cxx index 70cd46f88..ce5782854 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -211,7 +211,7 @@ SString &SString::append(const char *sOther, lenpos_t sLenOther, char sep) { } SString &SString::insert(lenpos_t pos, const char *sOther, lenpos_t sLenOther) { - if (!sOther) { + if (!sOther || pos > sLen) { return *this; } if (sLenOther == measure_length) { @@ -230,12 +230,16 @@ SString &SString::insert(lenpos_t pos, const char *sOther, lenpos_t sLenOther) { return *this; } -/** Remove @a len characters from the @a pos position, included. +/** + * Remove @a len characters from the @a pos position, included. * Characters at pos + len and beyond replace characters at pos. * If @a len is 0, or greater than the length of the string * starting at @a pos, the string is just truncated at @a pos. */ void SString::remove(lenpos_t pos, lenpos_t len) { + if (pos >= sLen) { + return; + } if (len < 1 || pos + len >= sLen) { s[pos] = '\0'; sLen = pos; |