diff options
author | nyamatongwe <unknown> | 2001-05-24 08:09:25 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2001-05-24 08:09:25 +0000 |
commit | 7c2577d6cb8e5350ba9f7490d81e3ce4e953c5b6 (patch) | |
tree | c830e1f0a83eeab1d3a490e16d12b20adac861c5 | |
parent | 22826177762e6282f5b933b023795cbab3360579 (diff) | |
download | scintilla-mirror-7c2577d6cb8e5350ba9f7490d81e3ce4e953c5b6.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]; } } } |