[gs-commits] rev 11853 - trunk/gs/base

alexcher at ghostscript.com alexcher at ghostscript.com
Tue Oct 26 14:14:25 UTC 2010


Author: alexcher
Date: 2010-10-26 14:14:24 +0000 (Tue, 26 Oct 2010)
New Revision: 11853

Modified:
   trunk/gs/base/sjpx_luratech.c
Log:
Generate fully opaque mask when /SMaskInData attribute is specified in PDF
but JPX stream has no opacity channel. Fix the case of missing images on
Luratech decoder in fts_17_1717.pdf and fts_17_1718.pdf.


Modified: trunk/gs/base/sjpx_luratech.c
===================================================================
--- trunk/gs/base/sjpx_luratech.c	2010-10-25 23:16:06 UTC (rev 11852)
+++ trunk/gs/base/sjpx_luratech.c	2010-10-26 14:14:24 UTC (rev 11853)
@@ -554,9 +554,12 @@
 
             /* allocate our output buffer */
             int real_bpc = state->bpc > 8 ? 16 : state->bpc;
-            state->stride = (state->width * state->ncomp * real_bpc + 7) / 8;
-            state->image = malloc(state->stride*state->height + 1); /* malloc(0) may be 0 */
-            if (state->image == NULL) return ERRC;
+            state->stride = (state->width * max(1, state->ncomp) * real_bpc + 7) / 8;
+            state->image = malloc(state->stride*state->height);
+            if (state->image == NULL) 
+                return ERRC;
+            if (state->ncomp == 0) /* make fully opaque mask */
+                memset(state->image, 255, state->stride*state->height);
 
             /* attach our output callback */
             err = JP2_Decompress_SetProp(state->handle,



More information about the gs-commits mailing list