[gs-commits] ghostpdl branch, gs9.28-temp-for-testing, updated. gs9.28-temp-for-testing-tag-17-g92bc858
[email protected] (Robin Watts)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, gs9.28-temp-for-testing has been updated
via 92bc858b03f206a0e08ca956cb3e5d2a825dffe8 (commit)
from d80a7eacb629029828ccb79b8bee03a0b471b8c1 (commit)
----------------------------------------------------------------------
commit 92bc858b03f206a0e08ca956cb3e5d2a825dffe8
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 aecc354..b7d3d57 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(-)