[cairo-commit] src/cairo-truetype-subset.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Aug 8 12:27:54 PDT 2006


 src/cairo-truetype-subset.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

New commits:
diff-tree ac4922bd07db7a513b6dbe5443e95221d7827f79 (from 356e646dc66f3df0d97e2c26e9328650df745c1e)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Aug 8 15:27:21 2006 -0400

    [TrueType] Zero out padding memory in generated TrueType subset
    to make the output deterministic and fix valgrind errors.

diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 167140e..f1b0011 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -339,14 +339,16 @@ static unsigned long
 cairo_truetype_font_align_output (cairo_truetype_font_t *font)
 {
     int length, aligned, pad;
-    unsigned char *ignored;
+    unsigned char *padding;
 
     length = _cairo_array_num_elements (&font->output);
     aligned = (length + 3) & ~3;
     pad = aligned - length;
 
-    if (pad)
-	cairo_truetype_font_allocate_write_buffer (font, pad, &ignored);
+    if (pad) {
+	cairo_truetype_font_allocate_write_buffer (font, pad, &padding);
+	memset (padding, 0, pad);
+    }
 
     return aligned;
 }


More information about the cairo-commit mailing list