[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1656-gd9e1d94

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

----------------------------------------------------------------------
commit d9e1d9474e5e21fe8ed9a451b91c48233e629eee
Author: Shailesh Mistry <[email protected]>
Date:   Sun Sep 8 13:30:52 2019 +0100

    Bug 697545 : Prevent memory leaks and memory corruption.
    
    Prevent several memory leaks in pcl_enter_graphics_mode by releasing graphic state.
    Also prevent memory corruption by propagating error code from pcl_set_drawing_color.
    
    Error created using :-
    MEMENTO_FAILAT=14648 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0861.new

diff --git a/pcl/pcl/pcdraw.c b/pcl/pcl/pcdraw.c
index d08060c..3864f3e 100644
--- a/pcl/pcl/pcdraw.c
+++ b/pcl/pcl/pcdraw.c
@@ -92,7 +92,7 @@ pcl_set_drawing_color(pcl_state_t * pcs,
             code = pixmap_high_level_pattern(pcs->pgs);
         return code;
     }
-    return 0;
+    return code;
 }
 
 /*
diff --git a/pcl/pcl/rtgmode.c b/pcl/pcl/rtgmode.c
index a7e4172..43571f0 100644
--- a/pcl/pcl/rtgmode.c
+++ b/pcl/pcl/rtgmode.c
@@ -333,7 +333,10 @@ pcl_enter_graphics_mode(pcl_state_t * pcs, pcl_gmode_entry_t mode)
     if (code < 0) return code;
     code = pcl_set_drawing_color(pcs, pcs->pattern_type, pcs->current_pattern_id,
                           true);
-    if (code < 0) return code;
+    if (code < 0) {
+        (void)pcl_grestore(pcs);
+        return code;
+    }
     gs_setmatrix(pcs->pgs, &rst2dev);
 
     /* translate the origin of the forward transformation */


Summary of changes:
 pcl/pcl/pcdraw.c  | 2 +-
 pcl/pcl/rtgmode.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 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.