aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2013-05-19 21:25:29 +1000
committernyamatongwe <devnull@localhost>2013-05-19 21:25:29 +1000
commit6ab788d35277557b75338a8729d12a2528803529 (patch)
treee5a9887ed59a951adae9cb83e810b3bc878c645f
parentad5a314d565a4c0fb8bffdf21d263edcfd79ce43 (diff)
downloadscintilla-mirror-6ab788d35277557b75338a8729d12a2528803529.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