New Ghostscript/GhostPDL compiler warnings - 2019-05-29-02:30:51 - 9de16a6637b73e35f79d2d622de403b24e6502f2

[email protected] Wed, 29 May 2019 04:56:17 -0700 (PDT)
Newsgroups gmane.comp.printing.ghostscript.regression
Message-ID <20190529115617.77CFD2040527@i7>
Previous Revision: 808021913baf763e07cc9eabc3716bfa507380ff
 Current Revision: 9de16a6637b73e35f79d2d622de403b24e6502f2

commit 9de16a6637b73e35f79d2d622de403b24e6502f2
Author:     Robin Watts <[email protected]>
AuthorDate: Thu Mar 7 18:03:00 2019 +0000
CommitDate: Wed May 29 09:39:36 2019 +0100

    Move FILE * operations behind new gp_file * API.
    
    (squash of commits from filesec branch)
    
    Most of this commit is donkeywork conversions of calls from
    FILE * -> gp_file *, fwrite -> gp_fwrite etc. Pretty much every
    device is touched, along with the clist and parsing code.
    
    The more interesting changes are within gp.h (where the actual
    new API is defined), gpmisc.c (where the basic implementations
    live), and the platform specific levels (gp_mswin.c, gp_unifs.c
    etc where the platform specific implementations have been
    tweaked/renamed).
    
    File opening path validation
    
    All file opening routines now call a central routine for
    path validation.
    
    This then consults new entries in gs_lib_ctx to see if validation
    is enabled or not. If so, it validates the paths by seeing if
    they match.
    
    Simple C level functions for adding/removing/clearing paths, exposed
    through the gsapi level.
    
    Add 2 postscript operators for path control.
    
      <name> <string> .addcontrolpath -
    
        Add the given <string> (path) to the list of paths for
        controlset <name>, where <name> can be:
          /PermitFileReading
          /PermitFileWriting
          /PermitFileControl
          (Anything else -> rangecheck)
    
      - .activatepathcontrol -
    
        Enable path control. At this point PS cannot make any
        more changes, and all file access is checked.

base/gdebug.h
base/gdevdevn.c
base/gdevp14.c
base/gdevpccm.c
base/gdevpccm.h
base/gdevpipe.c
base/gdevprn.c
base/gdevprn.h
base/gdevvec.c
base/gdevvec.h
base/gp.h
base/gp_dosfs.c
base/gp_dvx.c
base/gp_mshdl.c
base/gp_msprn.c
base/gp_mswin.c
base/gp_ntfs.c
base/gp_os2.c
base/gp_os2fs.c
base/gp_os2pr.c
base/gp_os9.c
base/gp_unifs.c
base/gp_unix.c
base/gp_vms.c
base/gp_win32.c
base/gp_winfs.c
base/gp_winfs2.c
base/gpmisc.c
base/gpmisc.h
base/gsargs.c
base/gsargs.h
base/gsdevice.c
base/gsicc_create.c
base/gsicc_lcms2.c
base/gsicc_lcms2mt.c
base/gsicc_manage.c
base/gsinit.c
base/gsiodev.c
base/gsiodevs.c
base/gsiodisk.c
base/gsioram.c
base/gsiorom.c
base/gslib.h
base/gslibctx.c
base/gslibctx.h
base/gsmemory.h
base/gsmisc.c
base/gsroprun.c
base/gstiffio.c
base/gstiffio.h
base/gxblend.c
base/gxblend1.c
base/gxclfile.c
base/gxdevice.h
base/gxiodev.h
base/gxpcmap.c
base/lib.mak
base/msvctail.mak
base/sfxcommon.c
base/sfxfd.c
base/sfxstdio.c
base/stdpre.h
base/stream.h
base/tiff.mak
base/winlib.mak
contrib/contrib.mak
contrib/eplaser/gdevescv.c
contrib/gdevbjc_.c
contrib/gdevbjc_.h
contrib/gdevbjca.c
contrib/gdevcd8.c
contrib/gdevdj9.c
contrib/gdevgdi.c
contrib/gdevhl12.c
contrib/gdevln03.c
contrib/gdevlx32.c
contrib/gdevlx7.c
contrib/gdevmd2k.c
contrib/gdevop4w.c
contrib/gdevxes.c
contrib/japanese/dviprlib.c
contrib/japanese/gdev10v.c
contrib/japanese/gdevalps.c
contrib/japanese/gdevdmpr.c
contrib/japanese/gdevespg.c
contrib/japanese/gdevfmlbp.c
contrib/japanese/gdevfmpr.c
contrib/japanese/gdevj100.c
contrib/japanese/gdevlbp3.c
contrib/japanese/gdevmjc.c
contrib/japanese/gdevml6.c
contrib/japanese/gdevnpdl.c
contrib/japanese/gdevp201.c
contrib/japanese/gdevrpdl.c
contrib/lips4/gdevl4r.c
contrib/lips4/gdevl4v.c
contrib/lips4/gdevlprn.c
contrib/lips4/gdevlprn.h
contrib/opvp/gdevopvp.c
contrib/pcl3/eprn/eprnparm.c
contrib/pcl3/eprn/gdeveprn.c
contrib/pcl3/eprn/pagecount.c
contrib/pcl3/eprn/pagecount.h
contrib/pcl3/src/gdevpcl3.c
contrib/pcl3/src/pcl3opts.c
contrib/pcl3/src/pclgen.c
contrib/pcl3/src/pclgen.h
contrib/pcl3/src/pclscan.c
cups/gdevcups.c
devices/contrib.mak
devices/devs.mak
devices/gdev3852.c
devices/gdev4081.c
devices/gdev4693.c
devices/gdev8510.c
devices/gdevatx.c
devices/gdevbit.c
devices/gdevbj10.c
devices/gdevbmp.c
devices/gdevbmp.h
devices/gdevbmpc.c
devices/gdevccr.c
devices/gdevcdj.c
devices/gdevcfax.c
devices/gdevchameleon.c
devices/gdevcif.c
devices/gdevclj.c
devices/gdevcljc.c
devices/gdevcmykog.c
devices/gdevcslw.c
devices/gdevdfax.c
devices/gdevdjet.c
devices/gdevdjtc.c
devices/gdevdljm.c
devices/gdevdljm.h
devices/gdevdm24.c
devices/gdevepsc.c
devices/gdevepsn.c
devices/gdevescp.c
devices/gdevfax.c
devices/gdevfax.h
devices/gdevfpng.c
devices/gdevgprf.c
devices/gdevhl7x.c
devices/gdevicov.c
devices/gdevifno.c
devices/gdevijs.c
devices/gdevimgn.c
devices/gdevjbig2.c
devices/gdevjpeg.c
devices/gdevjpx.c
devices/gdevl31s.c
devices/gdevlbp8.c
devices/gdevlj56.c
devices/gdevlp8k.c
devices/gdevlxm.c
devices/gdevmgr.c
devices/gdevmiff.c
devices/gdevn533.c
devices/gdevo182.c
devices/gdevokii.c
devices/gdevpbm.c
devices/gdevpcx.c
devices/gdevpdfimg.c
devices/gdevperm.c
devices/gdevphex.c
devices/gdevpjet.c
devices/gdevplan.c
devices/gdevplib.c
devices/gdevpng.c
devices/gdevpsd.c
devices/gdevpsd.h
devices/gdevpsim.c
devices/gdevpxut.c
devices/gdevpxut.h
devices/gdevrinkj.c
devices/gdevsj48.c
devices/gdevstc.c
devices/gdevtfax.c
devices/gdevtfax.h
devices/gdevtfnx.c
devices/gdevtifs.c
devices/gdevtifs.h
devices/gdevtknk.c
devices/gdevtsep.c
devices/gdevupd.c
devices/gdevwpr2.c
devices/gdevxcf.c
devices/rinkj/rinkj-byte-stream.c
devices/rinkj/rinkj-byte-stream.h
devices/vector/gdevpdf.c
devices/vector/gdevpdfo.c
devices/vector/gdevpdfp.c
devices/vector/gdevpdfu.c
devices/vector/gdevpdfx.h
devices/vector/gdevpsu.c
devices/vector/gdevpsu.h
devices/vector/gdevpx.c
devices/vector/gdevtxtw.c
devices/vector/gdevxps.c
pcl/pl/pjparse.c
pcl/pl/pl.mak
pcl/pl/plapi.c
pcl/pl/plapi.h
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/plparams.c
pcl/pl/pltop.h
psi/files.h
psi/iapi.c
psi/iapi.h
psi/imain.c
psi/imain.h
psi/imainarg.c
psi/imainarg.h
psi/iminst.h
psi/int.mak
psi/psapi.c
psi/zfile.c
windows/ghostscript.vcproj
xps/ghostxps.h
xps/xpsjxr.c
xps/xpstop.c
xps/xpszip.c



Ghostscript:

new scan-build warnings:

./base/gp.h:306:12: warning: Access to field 'ferror' results in a dereference of a null pointer (loaded from variable 'f')
    return (f->ferror)(f);
           ^~~~~~~~~~~

./base/gpmisc.c:478:29: warning: Dereference of null pointer
        f->buffer = (char *)gs_alloc_bytes(f->memory, n, "gp_file(buffer)");
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./devices/gdevicov.c:148:30: warning: Access to field 'gs_lib_ctx' results in a dereference of a null pointer (loaded from field 'memory')
        if (IS_LIBCTX_STDOUT(pdev->memory, gp_get_file(file))) {
            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./devices/gdevicov.c:79:30: warning: Access to field 'gs_lib_ctx' results in a dereference of a null pointer (loaded from field 'memory')
        if (IS_LIBCTX_STDOUT(pdev->memory, gp_get_file(file))) {
            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


http://miles.ghostscript.com:8080/artifex/9de16a6637b73e35f79d2d622de403b24e6502f2/gs/index.html

http://miles.ghostscript.com:8080/artifex/9de16a6637b73e35f79d2d622de403b24e6502f2/gs-scan-build.txt



new cppcheck warnings (Cppcheck 1.72): 

base/gp_mswin.c:587: error: Buffer is accessed out of bounds: win_prntmp
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: ''.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_ARITH_RSHIFT=1'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_ARITH_RSHIFT=2'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_PTRS_ARE_SIGNED'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_SIZEOF_CHAR=1'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_SIZEOF_INT=2'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_SIZEOF_INT=4'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_SIZEOF_INT=8'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_SIZEOF_LONG=4'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_SIZEOF_LONG=8'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_SIZEOF_LONG_LONG=8'.
base/gp_os2.c:290: error: Invalid number of character '{' when these macros are defined: 'ARCH_SIZEOF_SHORT=2'.
contrib/opvp/gdevopvp.c:2126: error: Common realloc mistake: 'p' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3203: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3221: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3239: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3257: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3275: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3306: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3321: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3336: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3351: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:3368: error: Common realloc mistake: 'buff' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:4876: error: Common realloc mistake: 'points' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:4885: error: Common realloc mistake: 'opvp_p' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:4942: error: Common realloc mistake: 'points' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:4955: error: Common realloc mistake: 'points' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:4982: error: Common realloc mistake: 'points' nulled but not freed upon failure
contrib/opvp/gdevopvp.c:5006: error: Common realloc mistake: 'points' nulled but not freed upon failure

http://miles.ghostscript.com:8080/artifex/9de16a6637b73e35f79d2d622de403b24e6502f2/gs-cppcheck.txt




GhostPCL:

new scan-build warnings:

./base/gp.h:306:12: warning: Access to field 'ferror' results in a dereference of a null pointer (loaded from variable 'f')
    return (f->ferror)(f);
           ^~~~~~~~~~~

./base/gpmisc.c:478:29: warning: Dereference of null pointer
        f->buffer = (char *)gs_alloc_bytes(f->memory, n, "gp_file(buffer)");
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./devices/gdevicov.c:148:30: warning: Access to field 'gs_lib_ctx' results in a dereference of a null pointer (loaded from field 'memory')
        if (IS_LIBCTX_STDOUT(pdev->memory, gp_get_file(file))) {
            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./devices/gdevicov.c:79:30: warning: Access to field 'gs_lib_ctx' results in a dereference of a null pointer (loaded from field 'memory')
        if (IS_LIBCTX_STDOUT(pdev->memory, gp_get_file(file))) {
            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


http://miles.ghostscript.com:8080/artifex/9de16a6637b73e35f79d2d622de403b24e6502f2/pcl/index.html

http://miles.ghostscript.com:8080/artifex/9de16a6637b73e35f79d2d622de403b24e6502f2/pcl-scan-build.txt