diff options
author | nyamatongwe <devnull@localhost> | 2001-05-24 08:09:25 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2001-05-24 08:09:25 +0000 |
commit | c0b81ba84a7e8cda35bdd47692f5a3e77707eb10 (patch) | |
tree | c830e1f0a83eeab1d3a490e16d12b20adac861c5 | |
parent | c0c5f2e8dc9b2eb23e1106abb286c99d9ee4c6b0 (diff) | |
download | scintilla-mirror-c0b81ba84a7e8cda35bdd47692f5a3e77707eb10.tar.gz |
Prevented use of uninitialised data when somehing goes wrong with
measuring text such as incomplete DBCS characters.
-rw-r--r-- | win32/PlatWin.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 90540baf6..ab0cba5e1 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -526,6 +526,11 @@ void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions) // Eeek - a NULL DC or other foolishness could cause this. // The least we can do is set the positions to zero! memset(positions, 0, len * sizeof(*positions)); + } else if (fit < len) { + // For some reason, such as an incomplete DBCS character + // Not all the positions are filled in so make them equal to end. + for (int i=fit;i<len;i++) + positions[i] = positions[fit-1]; } } } |