[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1629-geeeb033
[email protected] (Robin Watts)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via eeeb033d21f22b128900ebc998668c87be725f7d (commit)
from 5569e2b2057a25ff1fe0b2b5106e71f2b5142f5c (commit)
----------------------------------------------------------------------
commit eeeb033d21f22b128900ebc998668c87be725f7d
Author: Robin Watts <[email protected]>
Date: Mon Sep 2 12:59:33 2019 +0100
Fix deep color mattes.
As seen with the content vanishing when rendering
tests_private/pdf/sumatra/uninitialized_value_with_JPX_images.pdf
to psdcmyk16. The Softmask on the image has a Matte of [1,1,1]
and the calculations in the current code overflow, meaning that
it comes out as completely white.
We resort to 64bit to avoid the overflow. Mattes are vanishingly
rare, so speed shouldn't be an issue. We can revisit if we ever
find a case that matters.
diff --git a/base/gdevp14.c b/base/gdevp14.c
index aad6a9a..993ad57 100644
--- a/base/gdevp14.c
+++ b/base/gdevp14.c
@@ -708,10 +708,12 @@ resolve_matte(pdf14_buf *maskbuf, byte *src_data, int src_planestride, int src_r
int b = mask_tr_fn[top+1]-a;
uint16_t matte_alpha = a + ((0x80 + b*(idx & 0xff))>>8);
+ /* matte's happen rarely enough that we allow ourselves to
+ * resort to 64bit here. */
if (matte_alpha != 0 && matte_alpha != 0xffff) {
for (i = 0; i < src_profile->num_comps; i++) {
int val = src_curr_ptr[i * src_planestride] - maskbuf->matte[i];
- int temp = ((unsigned int)(val * 0xffff) / matte_alpha) + maskbuf->matte[i];
+ int temp = (((int64_t)val) * 0xffff / matte_alpha) + maskbuf->matte[i];
/* clip */
if (temp > 0xffff)
Summary of changes:
base/gdevp14.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)