aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-05-24 08:09:25 +0000
committernyamatongwe <unknown>2001-05-24 08:09:25 +0000
commit7c2577d6cb8e5350ba9f7490d81e3ce4e953c5b6 (patch)
treec830e1f0a83eeab1d3a490e16d12b20adac861c5
parent22826177762e6282f5b933b023795cbab3360579 (diff)
downloadscintilla-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.cxx5
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];
}
}
}