aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2013-05-19 21:25:29 +1000
committernyamatongwe <unknown>2013-05-19 21:25:29 +1000
commitc6d9c772d77641ecb9eea2154e50506dbdae427e (patch)
tree950d4fee911afa189de9ad9b188055ba8997fd0e
parent8d885454a6148024507cdddde7868ff001922c4b (diff)
downloadscintilla-mirror-c6d9c772d77641ecb9eea2154e50506dbdae427e.tar.gz
Don't dereference character string when length is 0. May be a NULL pointer
and cause a crash and shouldn't read beyond length anyway.
-rw-r--r--src/Editor.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 2ebe1a759..59e2678ab 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -4147,7 +4147,7 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
if (treatAsDBCS) {
NotifyChar((static_cast<unsigned char>(s[0]) << 8) |
static_cast<unsigned char>(s[1]));
- } else {
+ } else if (len > 0) {
int byte = static_cast<unsigned char>(s[0]);
if ((byte < 0xC0) || (1 == len)) {
// Handles UTF-8 characters between 0x01 and 0x7F and single byte