ref: b5264ffff604bc9da416b86b6ed382aa75638dc9
parent: 99264987a0799fca10e9ccd0aeff86713878ba67
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Tue Aug 10 18:33:46 EDT 2004
Properly initialize the page buffer to the default pixel value. This caused, among other potential bugs, garbage and overlay effects under some malloc implementatons, though not on GNU/Linux. Fixes Ghostscript bugs 687530 and 687609. Thanks to Oleg Panashchenko for analysis. git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@314 ded80894-8fb9-0310-811b-c03f3676ab4d
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -150,6 +150,9 @@
return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
"failed to allocate buffer for page image");
} else {
+ /* 8.2 (3) fill the page with the default pixel value */
+ memset(page->image->data, (page->flags & 4) ? 0xFF : 0x00,
+ page->image->stride*page->image->height);
jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
"allocated %dx%d page image (%d bytes)",
page->image->width, page->image->height,