[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1894-g7e50bda
[email protected] (Julian Smith) Mon, 18 Nov 2019 18:13:00 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via 7e50bda19813d11555ff1ab4f7cb5c3e55ff0653 (commit)
via 05cfc3afb00404ddfd3c1eac635f369491995e5b (commit)
via 81e179af142575eab21633b2023e752e1e244c9a (commit)
via d57aff5bbdb206f00e4b0cb3b324616be10d358e (commit)
via 3aa36ebc3df83d339695fff58a73332d5304c47d (commit)
via 4a1a4e8ad165e678d3affab483460ec8b926d5dd (commit)
via 1ee350a81d5799785ab53b3eece6e853cc4c607b (commit)
via 884690a576e16043e674efb9d047a00760ac8443 (commit)
via 9763a006f7c566e92f60e799fb2270c09807e9c8 (commit)
via dd84fd3a36d0ef809ed697ed12f1bb04655a0388 (commit)
via a631e0d40337da58ba596a9499b71c1d7888c9d5 (commit)
via 6fbd278d11e9ea567ea2dce0c7aa02e706d9a9e2 (commit)
from e05d0e17c75adab181413c8bf5bf6760c76683e4 (commit)
----------------------------------------------------------------------
commit 7e50bda19813d11555ff1ab4f7cb5c3e55ff0653
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 17:36:54 2019 +0000
Coverity 341025: removed unreachable line of code.
diff --git a/pcl/pl/plmain.c b/pcl/pl/plmain.c
index 0736eec..5921413 100644
--- a/pcl/pl/plmain.c
+++ b/pcl/pl/plmain.c
@@ -1229,7 +1229,6 @@ set_string_param(pl_main_instance_t * pmi, const char *arg)
strlen("DefaultCMYKProfile"))) {
dmprintf(pmi->memory, "DefaultCMYKProfile can only be set on the command line!\n");
return -1;
- pmi->pdefault_cmyk_icc = arg_copy(value, pmi->memory);
} else if (!strncmp(arg, "ICCProfileDir", strlen("ICCProfileDir"))) {
dmprintf(pmi->memory, "ICCProfileDir can only be set on the command line!\n");
return -1;
----------------------------------------------------------------------
commit 05cfc3afb00404ddfd3c1eac635f369491995e5b
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 17:34:49 2019 +0000
Coverity 331894: check return from gs_bbox_transform().
diff --git a/pcl/pl/plchar.c b/pcl/pl/plchar.c
index 40f9be0..9323617 100644
--- a/pcl/pl/plchar.c
+++ b/pcl/pl/plchar.c
@@ -1074,7 +1074,9 @@ pl_tt_build_char(gs_show_enum * penum, gs_gstate * pgs, gs_font * pfont,
gs_make_scaling(scale, scale, &smat);
sbox.p.x = w2[2], sbox.p.y = w2[3];
sbox.q.x = w2[4], sbox.q.y = w2[5];
- gs_bbox_transform(&sbox, &smat, &sbox);
+ code = gs_bbox_transform(&sbox, &smat, &sbox);
+ if (code < 0)
+ return code;
ipx = (int)sbox.p.x, ipy = (int)sbox.p.y;
iqx = (int)ceil(sbox.q.x), iqy = (int)ceil(sbox.q.y);
/* Set up the memory device for the bitmap. NB should check code. */
----------------------------------------------------------------------
commit 81e179af142575eab21633b2023e752e1e244c9a
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 17:32:05 2019 +0000
Coverity 331893: check return code from gs_bbox_transform().
diff --git a/base/gxclimag.c b/base/gxclimag.c
index c866b2c..7f5ea57 100644
--- a/base/gxclimag.c
+++ b/base/gxclimag.c
@@ -999,7 +999,9 @@ clist_image_plane_data(gx_image_enum_common_t * info,
sbox.p.y = (y0 = y_orig) - pie->support.y;
sbox.q.x = pie->rect.q.x + pie->support.x;
sbox.q.y = (y1 = pie->y += yh_used) + pie->support.y;
- gs_bbox_transform(&sbox, &pie->matrix, &dbox);
+ code = gs_bbox_transform(&sbox, &pie->matrix, &dbox);
+ if (code < 0)
+ return code;
/*
* In order to keep the band list consistent, we must write out
* the image data in precisely those bands whose begin_image
----------------------------------------------------------------------
commit d57aff5bbdb206f00e4b0cb3b324616be10d358e
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 17:28:42 2019 +0000
Coverity 323321: avoid dead code.
diff --git a/base/gdevdrop.c b/base/gdevdrop.c
index dfc6945..b9a08d0 100644
--- a/base/gdevdrop.c
+++ b/base/gdevdrop.c
@@ -1652,7 +1652,7 @@ template_mem_transform_pixel_region_render_landscape(gx_device *dev, mem_transfo
goto err;
data = run;
}
- return (code < 0 ? code : 1);
+ return 1;
/* Save position if error, in case we resume. */
err:
buffer[0] = run;
----------------------------------------------------------------------
commit 3aa36ebc3df83d339695fff58a73332d5304c47d
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 15:24:44 2019 +0000
Coverity 323317, 323320: avoid dead code.
Fixes coverity errors for transform_pixel_region_render_landscape() and
transform_pixel_region_render_skew().
diff --git a/base/gdevdflt.c b/base/gdevdflt.c
index d493068..92edd4c 100644
--- a/base/gdevdflt.c
+++ b/base/gdevdflt.c
@@ -2055,7 +2055,7 @@ transform_pixel_region_render_landscape(gx_device *dev, gx_default_transform_pix
goto err;
data = run;
}
- return (code < 0 ? code : 1);
+ return 1;
/* Save position if error, in case we resume. */
err:
buffer[0] = run;
@@ -2120,7 +2120,7 @@ transform_pixel_region_render_skew(gx_device *dev, gx_default_transform_pixel_re
prev = data;
data += spp;
}
- return (code < 0 ? code : 1);
+ return 1;
/* Save position if error, in case we resume. */
err:
/* Only set buffer[0] if we've managed to set prev to something valid. */
----------------------------------------------------------------------
commit 4a1a4e8ad165e678d3affab483460ec8b926d5dd
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 14:49:38 2019 +0000
Coverity 261213: make pxPassthrough_pcl_state_nonpage_exceptions() check return from pcl_set_graphics_state().
Also changed pxPassthrough_pcl_state_nonpage_exceptions() to return an int, and
made all of its callers check the return value.
diff --git a/pcl/pxl/pxpthr.c b/pcl/pxl/pxpthr.c
index 1b52a57..a0a1527 100644
--- a/pcl/pxl/pxpthr.c
+++ b/pcl/pxl/pxpthr.c
@@ -80,15 +80,20 @@ pcl_end_page_noop(pcl_state_t * pcs, int num_copies, int flush)
/* set variables other than setting the page device that do not
default to pcl reset values */
-void
+int
pxPassthrough_pcl_state_nonpage_exceptions(px_state_t * pxs)
{
/* xl cursor -> pcl cursor position */
gs_point xlcp, pclcp, dp;
-
+ int code;
+
/* make the pcl ctm active, after resets the hpgl/2 ctm is
active. */
- pcl_set_graphics_state(global_pcs);
+ code = pcl_set_graphics_state(global_pcs);
+ if (code < 0) {
+ return code;
+ }
+
/* xl current point -> device point -> pcl current
point. If anything fails we assume the current
point is not valid and use the cap from the pcl
@@ -123,6 +128,7 @@ pxPassthrough_pcl_state_nonpage_exceptions(px_state_t * pxs)
global_char_scale.y = pxs->pxgs->char_scale.y;
global_char_bold_value = pxs->pxgs->char_bold_value;
+ return 0;
}
/* retrieve the current pcl state and initialize pcl */
@@ -268,13 +274,18 @@ pxPassthrough(px_args_t * par, px_state_t * pxs)
code = pxPassthrough_setpagestate(pxs);
if (code < 0)
return code;
- pxPassthrough_pcl_state_nonpage_exceptions(pxs);
+ code = pxPassthrough_pcl_state_nonpage_exceptions(pxs);
+ if (code < 0)
+ return code;
global_pass_first = false;
} else {
/* there was a previous passthrough check if there were
any intervening XL commands */
- if (global_this_pass_contiguous == false)
- pxPassthrough_pcl_state_nonpage_exceptions(pxs);
+ if (global_this_pass_contiguous == false) {
+ code = pxPassthrough_pcl_state_nonpage_exceptions(pxs);
+ if (code < 0)
+ return code;
+ }
}
par->source.phase = 1;
}
@@ -393,13 +404,18 @@ pxpcl_selectfont(px_args_t * par, px_state_t * pxs)
code = pxPassthrough_setpagestate(pxs);
if (code < 0)
return code;
- pxPassthrough_pcl_state_nonpage_exceptions(pxs);
+ code = pxPassthrough_pcl_state_nonpage_exceptions(pxs);
+ if (code < 0)
+ return code;
global_pass_first = false;
} else {
/* there was a previous passthrough check if there were
any intervening XL commands */
- if (global_this_pass_contiguous == false)
- pxPassthrough_pcl_state_nonpage_exceptions(pxs);
+ if (global_this_pass_contiguous == false) {
+ code = pxPassthrough_pcl_state_nonpage_exceptions(pxs);
+ if (code < 0)
+ return code;
+ }
}
r.ptr = str - 1;
r.limit = str + len - 1;
diff --git a/pcl/pxl/pxpthr.h b/pcl/pxl/pxpthr.h
index 6d06bd9..881ffbb 100644
--- a/pcl/pxl/pxpthr.h
+++ b/pcl/pxl/pxpthr.h
@@ -35,7 +35,7 @@ void pxpcl_release(void);
/* set variables in pcl's state that are special to pass through mode,
these override the default pcl state variables when pcl is
entered. */
-void pxPassthrough_pcl_state_nonpage_exceptions(px_state_t * pxs);
+int pxPassthrough_pcl_state_nonpage_exceptions(px_state_t * pxs);
int pxpcl_selectfont(px_args_t * par, px_state_t * pxs);
----------------------------------------------------------------------
commit 1ee350a81d5799785ab53b3eece6e853cc4c607b
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 14:38:10 2019 +0000
Coverity 261210: wrap call of pcl_mark_page_for_path() in hpgl_call().
diff --git a/pcl/pcl/pgdraw.c b/pcl/pcl/pgdraw.c
index 9d17414..f0a1d99 100644
--- a/pcl/pcl/pgdraw.c
+++ b/pcl/pcl/pgdraw.c
@@ -1570,7 +1570,7 @@ hpgl_draw_current_path(hpgl_state_t * pgls, hpgl_rendering_mode_t render_mode)
min(scale.x,
scale.y) * 0.0375 * 0.2835));
}
- pcl_mark_page_for_path(pgls);
+ hpgl_call(pcl_mark_page_for_path(pgls));
hpgl_call(gs_stroke(pgls->pgs));
break;
----------------------------------------------------------------------
commit 884690a576e16043e674efb9d047a00760ac8443
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 12:31:33 2019 +0000
Coverity 135902: remove support for USE_MAP_TYPE_IN_SPECIFICATION.
We now always treat map type 0 as map type 1. As suggested by henrystyles.
This will fix coverity issue.
diff --git a/pcl/pcl/pctext.c b/pcl/pcl/pctext.c
index d37fa06..507a936 100644
--- a/pcl/pcl/pctext.c
+++ b/pcl/pcl/pctext.c
@@ -65,13 +65,6 @@ pcl_downloaded_and_bound(const pl_font_t * plfont)
return (plfont->storage != pcds_internal && pl_font_is_bound(plfont));
}
-/* uncomment the following definition to treat map type 0 as defined
- in the specification. The default is to use the behavior we have
- observed on several HP devices. Map type 0 is treated as map type
- 1. */
-
-/* #define USE_MAP_TYPE_IN_SPECIFICATION */
-
/*
* Check if a character code is considered "printable" by given symbol set.
*/
@@ -100,14 +93,15 @@ char_is_printable(const pl_font_t *font, const pl_symbol_map_t *map, gs_char chr
map_type = map->type;
}
-#ifndef USE_MAP_TYPE_IN_SPECIFICATION
- if (map_type == 0)
+ /* We do not treat map type as defined in the
+ specification. Instead the default is to use the behavior we have
+ observed on several HP devices: Map type 0 is treated as map type
+ 1. */
+ if (map_type == 0) {
map_type = 1;
-#endif /* USE_MAP_TYPE_IN_SPECIFICATION */
+ }
- if (map_type == 0)
- printable = (chr >= ' ') && (chr <= '\177');
- else if (map_type == 1) {
+ if (map_type == 1) {
chr &= 0x7f;
printable = (chr >= ' '); /* 0-31 and 128-159 are not printable */
} else if (map_type >= 2) {
----------------------------------------------------------------------
commit 9763a006f7c566e92f60e799fb2270c09807e9c8
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 12:20:17 2019 +0000
Coverity 135902: Fixed indentation in char_is_printable().
This commit has no output from 'git diff -w', and is in preparation for next
commit that fixes coverity issue.
diff --git a/pcl/pcl/pctext.c b/pcl/pcl/pctext.c
index 74baca8..d37fa06 100644
--- a/pcl/pcl/pctext.c
+++ b/pcl/pcl/pctext.c
@@ -83,43 +83,43 @@ char_is_printable(const pl_font_t *font, const pl_symbol_map_t *map, gs_char chr
if (literal) { /* transparent data */
printable = true;
} else {
- if (is_stick) {
- printable = (chr >= ' ') && (chr <= 0xff);
- } else {
- int map_type = 0;
- if (map == 0 || pcl_downloaded_and_bound(font)) {
- /* PCL TRM 11-18 */
- if (font)
- {
- map_type = font->font_type;
- }
+ if (is_stick) {
+ printable = (chr >= ' ') && (chr <= 0xff);
} else {
- /* PCL TRM 10-7
- * symbol map type overrides, font map type
- */
- map_type = map->type;
- }
+ int map_type = 0;
+ if (map == 0 || pcl_downloaded_and_bound(font)) {
+ /* PCL TRM 11-18 */
+ if (font)
+ {
+ map_type = font->font_type;
+ }
+ } else {
+ /* PCL TRM 10-7
+ * symbol map type overrides, font map type
+ */
+ map_type = map->type;
+ }
#ifndef USE_MAP_TYPE_IN_SPECIFICATION
- if (map_type == 0)
- map_type = 1;
+ if (map_type == 0)
+ map_type = 1;
#endif /* USE_MAP_TYPE_IN_SPECIFICATION */
- if (map_type == 0)
- printable = (chr >= ' ') && (chr <= '\177');
- else if (map_type == 1) {
- chr &= 0x7f;
- printable = (chr >= ' '); /* 0-31 and 128-159 are not printable */
- } else if (map_type >= 2) {
- /* 2 is correct but will force all types above 2 here */
- if ((chr == 0) || (chr == '\033') ||
- ((chr >= '\007') && (chr <= '\017')))
- printable = false;
- else
- printable = true;
+ if (map_type == 0)
+ printable = (chr >= ' ') && (chr <= '\177');
+ else if (map_type == 1) {
+ chr &= 0x7f;
+ printable = (chr >= ' '); /* 0-31 and 128-159 are not printable */
+ } else if (map_type >= 2) {
+ /* 2 is correct but will force all types above 2 here */
+ if ((chr == 0) || (chr == '\033') ||
+ ((chr >= '\007') && (chr <= '\017')))
+ printable = false;
+ else
+ printable = true;
+ }
}
}
- }
return printable;
}
----------------------------------------------------------------------
commit dd84fd3a36d0ef809ed697ed12f1bb04655a0388
Author: Julian Smith <[email protected]>
Date: Fri Nov 15 16:55:22 2019 +0000
Coverity 102254: avoid integer division when calculating double value.
It's possible that this could alter behaviour, but clusterpush showed no
additional regressions.
diff --git a/pcl/pcl/pctext.c b/pcl/pcl/pctext.c
index cc5da2f..74baca8 100644
--- a/pcl/pcl/pctext.c
+++ b/pcl/pcl/pctext.c
@@ -990,8 +990,8 @@ pcl_font_scale(pcl_state_t * pcs, gs_point * pscale)
{
/* set up the font transformation */
if (pcs->font->scaling_technology == plfst_bitmap) {
- pscale->x = pcl_coord_scale / pcs->font->resolution.x;
- pscale->y = pcl_coord_scale / pcs->font->resolution.y;
+ pscale->x = (double) pcl_coord_scale / pcs->font->resolution.x;
+ pscale->y = (double) pcl_coord_scale / pcs->font->resolution.y;
} else {
/*
* Outline fonts are 1-point; the font height is given in
----------------------------------------------------------------------
commit a631e0d40337da58ba596a9499b71c1d7888c9d5
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 12:08:38 2019 +0000
Coverity 126570: build_foreground(): return error if pindexed is NULL.
Previously we would dereference pindexed which would inevitably SEGV.
diff --git a/pcl/pcl/pcfrgrnd.c b/pcl/pcl/pcfrgrnd.c
index 8463f33..31968a3 100644
--- a/pcl/pcl/pcfrgrnd.c
+++ b/pcl/pcl/pcfrgrnd.c
@@ -82,6 +82,10 @@ build_foreground(pcl_state_t * pcs,
int num_entries;
bool is_default = false;
int code = 0;
+
+ if (!pindexed) {
+ return_error(gs_error_invalidaccess);
+ }
/*
* Check for a request for the default foreground. Since there are only
@@ -89,8 +93,7 @@ build_foreground(pcl_state_t * pcs,
* is fixed and has two entries. The default foreground is black, which is
* the second of the two entries.
*/
- if ((pindexed != 0) &&
- (pindexed->pfixed) && (pindexed->num_entries == 2) && (pal_entry == 1)) {
+ if ((pindexed->pfixed) && (pindexed->num_entries == 2) && (pal_entry == 1)) {
is_default = true;
if (pcs->pdflt_frgrnd != 0) {
pcl_frgrnd_copy_from(*ppfrgrnd, pcs->pdflt_frgrnd);
----------------------------------------------------------------------
commit 6fbd278d11e9ea567ea2dce0c7aa02e706d9a9e2
Author: Julian Smith <[email protected]>
Date: Mon Nov 18 11:25:16 2019 +0000
Coverity: try using C++ comment style for 'coverity[ -tainted_data_return ]'
E.g. for:
https://scan4.coverity.com/reports.htm#v46841/p11408/fileInstanceId=69767421&defectInstanceId=11904740&mergedDefectId=95049
diff --git a/jbig2dec/jbig2.c b/jbig2dec/jbig2.c
index 3d9f270..28d3203 100644
--- a/jbig2dec/jbig2.c
+++ b/jbig2dec/jbig2.c
@@ -191,14 +191,14 @@ jbig2_get_uint16(const byte *bptr)
return get_uint16(bptr);
}
-/* coverity[ -tainted_data_return ] */
+// coverity[ -tainted_data_return ]
int32_t
jbig2_get_int32(const byte *bptr)
{
return ((int32_t) get_int16(bptr) << 16) | get_uint16(bptr + 2);
}
-/* coverity[ -tainted_data_return ] */
+// coverity[ -tainted_data_return ]
uint32_t
jbig2_get_uint32(const byte *bptr)
{
Summary of changes:
base/gdevdflt.c | 4 +--
base/gdevdrop.c | 2 +-
base/gxclimag.c | 4 ++-
jbig2dec/jbig2.c | 4 +--
pcl/pcl/pcfrgrnd.c | 7 +++--
pcl/pcl/pctext.c | 78 +++++++++++++++++++++++++-----------------------------
pcl/pcl/pgdraw.c | 2 +-
pcl/pl/plchar.c | 4 ++-
pcl/pl/plmain.c | 1 -
pcl/pxl/pxpthr.c | 34 +++++++++++++++++-------
pcl/pxl/pxpthr.h | 2 +-
11 files changed, 79 insertions(+), 63 deletions(-)