mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 04:08:13 +02:00
win32: Fix regression with text containing space character
Converting a series of glyphs to a path triggers an out of memory error if there is a space glyph (bytesGlyph==0). The regression was introduced by commit19982393in cairo-win32-font.c:107. The behavior of malloc(0) is not well defined - it can return NULL on some platforms, or an arbitrary (non-allocated) pointer on other platforms. Commit19982393introduced sanity by enforcing that NULL is always returned in this situation, which inappropriately triggers the OOM check in _cairo_win32_scaled_font_init_glyph_path(). Instead, special case the handling for bytesGlyph==0. Patch authored by Uli Schlachter, based on fix proposed by lb90. Fixes: https://gitlab.freedesktop.org/cairo/cairo/issues/339 Reference: https://gitlab.gnome.org/GNOME/pango/issues/323 Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
This commit is contained in:
parent
7786b8fe4e
commit
3a03c1ba4b
1 changed files with 1 additions and 1 deletions
|
|
@ -1697,7 +1697,7 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
|
|||
}
|
||||
|
||||
ptr = buffer = _cairo_malloc (bytesGlyph);
|
||||
if (!buffer) {
|
||||
if (!buffer && bytesGlyph != 0) {
|
||||
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
goto CLEANUP_FONT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue