diff --git a/src/w32font.c b/src/w32font.c index bd68e22cc9..fe85601380 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -704,11 +704,20 @@ w32font_draw (struct glyph_string *s, int from, int to, int i; for (i = 0; i < len; i++) - ExtTextOutW (s->hdc, x + i, y, options, NULL, - s->char2b + from + i, 1, NULL); + { + const wchar_t ch = s->char2b[from + i]; + ExtTextOutW (s->hdc, x + i, y, options, NULL, &ch, 1, NULL); + } } else - ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, len, NULL); + { + USE_SAFE_ALLOCA; + wchar_t *str = SAFE_ALLOCA (len); + for (int i = 0; i < len; ++i) + str[i] = s->char2b[from + i]; + ExtTextOutW (s->hdc, x, y, options, NULL, str, len, NULL); + SAFE_FREE (); + } /* Restore clip region. */ if (s->num_clips > 0)