[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1760-g2c2dc33

[email protected] (Ken Sharp) Sat, 26 Oct 2019 16:14:29 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  2c2dc335c212750e0fb8ae157063bc06cafa8d3e (commit)
      from  bfeff28bb56ee4424ac78619792c18bf4f5104ef (commit)

----------------------------------------------------------------------
commit 2c2dc335c212750e0fb8ae157063bc06cafa8d3e
Author: Ken Sharp <[email protected]>
Date:   Sat Oct 26 17:14:23 2019 +0100

    Color Laserjet device - properly check params
    
    Bug #701796 "Segmentation fault at devices/gdevclj.c:269 in clj_media_size"
    
    The test in clj_media_size() as incorrect, it didn't signal an error if
    there was no HWResolution in the param list. This left the parameter
    'fres' undefined leading to a potential invalid memory read, or a
    divide-by-zero error.
    
    This commit returns an error if we get a param list with no HWResolution
    I'm not absolutely certain if this is correct, but at least signalling
    an error is better than a seg fault.

diff --git a/devices/gdevclj.c b/devices/gdevclj.c
index d5b4668..a293ec4 100644
--- a/devices/gdevclj.c
+++ b/devices/gdevclj.c
@@ -254,7 +254,7 @@ clj_media_size(float mediasize[2], gs_param_list *plist)
     gs_param_int_array hwsize;
     int have_pagesize = 0;
 
-    if ( (param_read_float_array(plist, "HWResolution", &fres) == 0) &&
+    if ( param_read_float_array(plist, "HWResolution", &fres) != 0 ||
           !is_supported_resolution(fres.data) )
         return_error(gs_error_rangecheck);
 


Summary of changes:
 devices/gdevclj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)