From 7c2577d6cb8e5350ba9f7490d81e3ce4e953c5b6 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 24 May 2001 08:09:25 +0000 Subject: Prevented use of uninitialised data when somehing goes wrong with measuring text such as incomplete DBCS characters. --- win32/PlatWin.cxx | 5 +++++ 1 file changed, 5 insertions(+) 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