blob: 94750f2648e02bfed3652b6ff26efa7de781cff8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
$NetBSD: patch-ad,v 1.12.2.2 2011/03/05 17:58:14 spz Exp $
https://bugzilla.gnome.org/show_bug.cgi?id=639882
--- pango/pangoft2-render.c.orig 2010-02-09 12:06:28.000000000 +0000
+++ pango/pangoft2-render.c
@@ -121,9 +121,14 @@ pango_ft2_font_render_box_glyph (int
box->bitmap.width = width;
box->bitmap.rows = height;
- box->bitmap.pitch = height;
+ box->bitmap.pitch = width;
- box->bitmap.buffer = g_malloc0 (box->bitmap.rows * box->bitmap.pitch);
+ box->bitmap.buffer = g_malloc0_n (box->bitmap.rows, box->bitmap.pitch);
+
+ if (G_UNLIKELY (!box->bitmap.buffer)) {
+ g_slice_free (PangoFT2RenderedGlyph, box);
+ return NULL;
+ }
/* draw the box */
for (j = 0; j < line_width; j++)
@@ -226,6 +231,11 @@ pango_ft2_font_render_glyph (PangoFont *
rendered->bitmap_left = face->glyph->bitmap_left;
rendered->bitmap_top = face->glyph->bitmap_top;
+ if (G_UNLIKELY (!rendered->bitmap.buffer)) {
+ g_slice_free (PangoFT2RenderedGlyph, rendered);
+ return NULL;
+ }
+
return rendered;
}
else
@@ -276,6 +286,8 @@ pango_ft2_renderer_draw_glyph (PangoRend
if (rendered_glyph == NULL)
{
rendered_glyph = pango_ft2_font_render_glyph (font, glyph);
+ if (rendered_glyph == NULL)
+ return;
add_glyph_to_cache = TRUE;
}
|