diff options
| author | Neil <nyamatongwe@gmail.com> | 2013-08-02 13:31:48 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2013-08-02 13:31:48 +1000 |
| commit | 9d1102db6caf15c5baa894356d23c570b771e711 (patch) | |
| tree | e412507a4b0061bebde64aeaef55f9a8a0881895 /win32/PlatWin.cxx | |
| parent | 16eba3677a717a1332ba661b454cd3eb8ccb2a0e (diff) | |
| download | scintilla-mirror-9d1102db6caf15c5baa894356d23c570b771e711.tar.gz | |
Fix failures when invalid DBCS text was measured by ensuring
all positions are filled with reasonable non-negative values.
Diffstat (limited to 'win32/PlatWin.cxx')
| -rw-r--r-- | win32/PlatWin.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 97d7eddb5..0b57037af 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1747,14 +1747,17 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION * } else { // May be more than one byte per position - int ui = 0; + unsigned int ui = 0; + FLOAT position = 0.0f; for (int i=0;i<len;) { + if (ui < count) + position = poses.buffer[ui]; if (Platform::IsDBCSLeadByte(codePageText, s[i])) { - positions[i] = poses.buffer[ui]; - positions[i+1] = poses.buffer[ui]; + positions[i] = position; + positions[i+1] = position; i += 2; } else { - positions[i] = poses.buffer[ui]; + positions[i] = position; i++; } |
