[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1748-ga44d0ce
[email protected] (Robin Watts) Wed, 23 Oct 2019 15:53:45 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via a44d0ce727f2095fbbedb8bf6b1e062fca3c8f01 (commit)
via 4637eeae2415b593d84bb60dbac5369eb2ecc54b (commit)
via dc3b7d7f6882e1ed1ff41083ff22893efc5c5afa (commit)
from 3ff1490e231c8b02ce77386a75f23ac76e97cc29 (commit)
----------------------------------------------------------------------
commit a44d0ce727f2095fbbedb8bf6b1e062fca3c8f01
Author: Shailesh Mistry <[email protected]>
Date: Fri Sep 27 11:16:23 2019 +0100
Bug 697545 : Prevent memory leaks in gx_cpath_assign_preserve.
Update functionality to propagate error codes correctly and release path segments.
Error created using :-
MEMENTO_FAILAT=15840 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.1552
diff --git a/base/gxacpath.c b/base/gxacpath.c
index 6487c30..ebed0eb 100644
--- a/base/gxacpath.c
+++ b/base/gxacpath.c
@@ -228,8 +228,8 @@ gx_cpath_accum_end(gx_device_cpath_accum * padev, gx_clip_path * pcpath)
apath.path_valid = false;
apath.id = gs_next_ids(padev->list_memory, 1); /* path changed => change id */
apath.cached = NULL;
- gx_cpath_assign_free(pcpath, &apath);
- return 0;
+ code = gx_cpath_assign_free(pcpath, &apath);
+ return code;
}
/* Discard an accumulator in case of error. */
diff --git a/base/gxcpath.c b/base/gxcpath.c
index ecdfe09..4c3d347 100644
--- a/base/gxcpath.c
+++ b/base/gxcpath.c
@@ -325,8 +325,10 @@ gx_cpath_assign_preserve(gx_clip_path * pcpto, gx_clip_path * pcpfrom)
int code = cpath_alloc_list(&tolist, tolist->rc.memory,
"gx_cpath_assign");
- if (code < 0)
+ if (code < 0) {
+ rc_decrement(pcpto->path.segments, "gx_path_assign");
return code;
+ }
rc_decrement(pcpto->rect_list, "gx_cpath_assign");
} else {
/* Use pcpto's list object. */
@@ -354,7 +356,7 @@ gx_cpath_assign_free(gx_clip_path * pcpto, gx_clip_path * pcpfrom)
int code = gx_cpath_assign_preserve(pcpto, pcpfrom);
if (code < 0)
- return 0;
+ return code;
gx_cpath_free(pcpfrom, "gx_cpath_assign_free");
return 0;
}
----------------------------------------------------------------------
commit 4637eeae2415b593d84bb60dbac5369eb2ecc54b
Author: Shailesh Mistry <[email protected]>
Date: Thu Sep 26 15:08:02 2019 +0100
Bug 697545 : Prevent memory leaks in hpgl_LB.
Update code to propagate error codes correctly and prevent font leaks.
Error created using :-
MEMENTO_FAILAT=19935 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.1480
diff --git a/pcl/pcl/pglabel.c b/pcl/pcl/pglabel.c
index e7a892c..153139b 100644
--- a/pcl/pcl/pglabel.c
+++ b/pcl/pcl/pglabel.c
@@ -1539,9 +1539,15 @@ hpgl_LB(hpgl_args_t * pargs, hpgl_state_t * pgls)
if (GL_LB_CH == CR && !pgls->g.transparent_data) {
gs_point lo_offsets;
- hpgl_call(hpgl_process_buffer(pgls, &lo_offsets));
+ code = hpgl_process_buffer(pgls, &lo_offsets);
hpgl_destroy_label_buffer(pgls);
- hpgl_call(hpgl_init_label_buffer(pgls));
+ if (code < 0)
+ return code;
+ code = hpgl_init_label_buffer(pgls);
+ if (code < 0) {
+ hpgl_free_stick_fonts(pgls);
+ return code;
+ }
}
}
pargs->source.ptr = p;
----------------------------------------------------------------------
commit dc3b7d7f6882e1ed1ff41083ff22893efc5c5afa
Author: Shailesh Mistry <[email protected]>
Date: Thu Sep 26 11:49:08 2019 +0100
Bug 697545 : Prevent memory leaks in hpgl_EP.
Update code to propagate error codes correctly and prevent graphic state leaks.
Error created using :-
MEMENTO_FAILAT=15166 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.1470
diff --git a/base/gxstroke.c b/base/gxstroke.c
index a15a22c..e3cc508 100644
--- a/base/gxstroke.c
+++ b/base/gxstroke.c
@@ -1053,9 +1053,9 @@ gx_stroke_path_only_aux(gx_path * ppath, gx_path * to_path, gx_device * pdev,
gx_path_free(&stroke_path_body, "gx_stroke_path_only error"); /* (only needed if error) */
if (to_path_reverse == &stroke_path_reverse)
gx_path_free(&stroke_path_reverse, "gx_stroke_path_only error");
+ exf:
if (dash_count)
gx_path_free(&dpath, "gx_stroke_path exit(dash path)");
- exf:
if (ppath->curve_count)
gx_path_free(&fpath, "gx_stroke_path exit(flattened path)");
return code;
diff --git a/pcl/pcl/pgpoly.c b/pcl/pcl/pgpoly.c
index 81fc79b..4c1d4cd 100644
--- a/pcl/pcl/pgpoly.c
+++ b/pcl/pcl/pgpoly.c
@@ -177,13 +177,24 @@ hpgl_EP(hpgl_args_t * pargs, hpgl_state_t * pgls)
{
/* preserve the current path and copy the polygon buffer to
the current path */
- hpgl_call(hpgl_gsave(pgls));
- hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
+ int code = hpgl_gsave(pgls);
+ if (code < 0)
+ return code;
+
+ code = hpgl_copy_polygon_buffer_to_current_path(pgls);
+ if (code < 0)
+ goto fail;
+
hpgl_set_hpgl_path_mode(pgls, true);
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector_no_close));
+ code = hpgl_draw_current_path(pgls, hpgl_rm_vector_no_close);
+ if (code < 0)
+ goto fail;
hpgl_set_hpgl_path_mode(pgls, false);
- hpgl_call(hpgl_grestore(pgls));
- return 0;
+ return hpgl_grestore(pgls);
+
+fail:
+ (void)hpgl_grestore(pgls);
+ return code;
}
/* ER dx,dy; */
Summary of changes:
base/gxacpath.c | 4 ++--
base/gxcpath.c | 6 ++++--
base/gxstroke.c | 2 +-
pcl/pcl/pglabel.c | 10 ++++++++--
pcl/pcl/pgpoly.c | 21 ++++++++++++++++-----
5 files changed, 31 insertions(+), 12 deletions(-)