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 | 0facb2ab7f766bb6279dd5a7929f7d9fdec6e087 (patch) | |
tree | 5354851b25bf6b9c245b07ef3dd2fa786ff953f7 | |
parent | faa54a06227905c0f8479ae76f01524f35d62e94 (diff) | |
download | scintilla-mirror-0facb2ab7f766bb6279dd5a7929f7d9fdec6e087.tar.gz |
Fix failures when invalid DBCS text was measured by ensuring
all positions are filled with reasonable non-negative values.
-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++; } |