[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1631-ge635040
[email protected] (Robin Watts)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via e63504054baea4275af88e95418b5282c4394685 (commit)
via cfdb64eec150da48dea5063b14ae7596e6b7050a (commit)
from eeeb033d21f22b128900ebc998668c87be725f7d (commit)
----------------------------------------------------------------------
commit e63504054baea4275af88e95418b5282c4394685
Author: Robin Watts <[email protected]>
Date: Tue Sep 3 18:15:56 2019 +0100
Avoid potential UMR with arg checking in arg sanitization code.
diff --git a/base/gslibctx.c b/base/gslibctx.c
index 64258e1..0285651 100644
--- a/base/gslibctx.c
+++ b/base/gslibctx.c
@@ -915,20 +915,23 @@ gs_lib_ctx_stash_sanitized_arg(gs_lib_ctx_t *ctx, const char *arg)
if (*p == 0)
break; /* No value to elide */
/* Check for our whitelisted values here */
- if (!memcmp("DEFAULTPAPERSIZE", arg+2, p-arg-3))
+#define ARG_MATCHES(STR, ARG, LEN) \
+ (strlen(STR) == LEN && !memcmp(STR, ARG, LEN))
+ if (ARG_MATCHES("DEFAULTPAPERSIZE", arg+2, p-arg-3))
break;
- if (!memcmp("DEVICE", arg+2, p-arg-3))
+ if (ARG_MATCHES("DEVICE", arg+2, p-arg-3))
break;
- if (!memcmp("PAPERSIZE", arg+2, p-arg-3))
+ if (ARG_MATCHES("PAPERSIZE", arg+2, p-arg-3))
break;
- if (!memcmp("SUBSTFONT", arg+2, p-arg-3))
+ if (ARG_MATCHES("SUBSTFONT", arg+2, p-arg-3))
break;
- if (!memcmp("ColorConversionStrategy", arg+2, p-arg-3))
+ if (ARG_MATCHES("ColorConversionStrategy", arg+2, p-arg-3))
break;
- if (!memcmp("PageList", arg+2, p-arg-3))
+ if (ARG_MATCHES("PageList", arg+2, p-arg-3))
break;
- if (!memcmp("ProcessColorModel", arg+2, p-arg-3))
+ if (ARG_MATCHES("ProcessColorModel", arg+2, p-arg-3))
break;
+#undef ARG_MATCHES
/* Didn't match a whitelisted value, so elide it. */
elide = 1;
break;
----------------------------------------------------------------------
commit cfdb64eec150da48dea5063b14ae7596e6b7050a
Author: Robin Watts <[email protected]>
Date: Mon Sep 2 17:16:45 2019 +0100
Proper fix for deep color overprint.
The previous fix confused memset and memcpy. Properly write the
(native endian) 16 bit color values into the big endian buffer.
diff --git a/base/gsovrc.c b/base/gsovrc.c
index ad75b58..d29808d 100644
--- a/base/gsovrc.c
+++ b/base/gsovrc.c
@@ -1055,6 +1055,16 @@ overprint_copy_planes(gx_device * dev, const byte * data, int data_x, int raster
x, y, w, h, plane_height);
}
}
+static void
+my_memset16_be(uint16_t *dst, uint16_t col, size_t w)
+{
+#if !ARCH_IS_BIG_ENDIAN
+ col = (col>>8) | (col<<8);
+#endif
+ while (w--) {
+ *dst++ = col;
+ }
+}
/* Currently we really should only be here if the target device is planar
AND it supports devn colors AND is 8 or 16 bit. */
@@ -1143,8 +1153,12 @@ overprint_fill_rectangle_hl_color(gx_device *dev,
operation we would just get the ones needed and set those. */
if ((comps & 0x01) == 1) {
/* Not sure if a loop or a memset is better here */
- memset(gb_params.data[k],
- ((pdcolor->colors.devn.values[k]) >> shift & mask), w<<deep);
+ if (deep)
+ my_memset16_be((uint16_t *)(gb_params.data[k]),
+ pdcolor->colors.devn.values[k], w);
+ else
+ memset(gb_params.data[k],
+ ((pdcolor->colors.devn.values[k]) >> shift & mask), w);
}
comps >>= 1;
}
Summary of changes:
base/gslibctx.c | 17 ++++++++++-------
base/gsovrc.c | 18 ++++++++++++++++--
2 files changed, 26 insertions(+), 9 deletions(-)