[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1680-g91d18ae

[email protected] (Shailesh Mistry)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  91d18aec6a19a0d3b341701d10355278f4703fdd (commit)
      from  8c5348ae5fc35b449aa68eb6668cb6cbc6f345e0 (commit)

----------------------------------------------------------------------
commit 91d18aec6a19a0d3b341701d10355278f4703fdd
Author: Shailesh Mistry <[email protected]>
Date:   Tue Sep 17 09:02:49 2019 +0100

    Bug 697545 : Prevent SEGV in download_pcl_pattern.
    
    The pattern is consumed by pl_dict_put during errors so remove second attempt to free it.
    
    Error created using :-
    MEMENTO_FAILAT=15501 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0954

diff --git a/pcl/pcl/pcuptrn.c b/pcl/pcl/pcuptrn.c
index 4393b96..c06fc27 100644
--- a/pcl/pcl/pcuptrn.c
+++ b/pcl/pcl/pcuptrn.c
@@ -196,8 +196,10 @@ define_pcl_ptrn(pcl_state_t * pcs, int id, pcl_pattern_t * pptrn, bool gl2)
     id_set_value(key, id);
     if (pptrn == 0)
         pl_dict_undef(pd, id_key(key), 2);
-    else if (pl_dict_put(pd, id_key(key), 2, pptrn) < 0)
+    else if (pl_dict_put(pd, id_key(key), 2, pptrn) < 0) {
+        /* on error, pl_dict_put consumes pptrn */
         return e_Memory;
+    }
 
     if (gl2) {
         if (pcs->last_gl2_RF_indx == id)
@@ -432,10 +434,7 @@ download_pcl_pattern(pcl_args_t * pargs, pcl_state_t * pcs)
     /* place the pattern into the pattern dictionary */
     if ((code < 0) ||
         ((code = define_pcl_ptrn(pcs, pcs->pattern_id, pptrn, false)) < 0)) {
-        if (pptrn != 0)
-            pcl_pattern_free_pattern(pcs->memory, pptrn,
-                                     "download PCL pattern");
-        else
+        if (pptrn == NULL)
             gs_free_object(pcs->memory,
                            (void *)pixinfo.data, "download PCL pattern");
     }


Summary of changes:
 pcl/pcl/pcuptrn.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.