New Ghostscript/GhostPDL compiler warnings - 2018-08-28-02:15:27 - c9b362ba908ca4b1d7c72663a33229588012d7d9

[email protected] Tue, 28 Aug 2018 04:38:35 -0700 (PDT)
Newsgroups gmane.comp.printing.ghostscript.regression
Message-ID <20180828113835.DD15A2040190@i7>
Previous Revision: ea735ba37dc0fd5f5622d031830b9a559dec1cc9
 Current Revision: c9b362ba908ca4b1d7c72663a33229588012d7d9

commit c9b362ba908ca4b1d7c72663a33229588012d7d9
Author:     Chris Liddell <[email protected]>
AuthorDate: Tue Aug 28 07:52:18 2018 +0100
CommitDate: Tue Aug 28 08:05:15 2018 +0100

    Bug 699670: disallow copying of the epo device
    
    The erasepage optimisation (epo) subclass device shouldn't be allowed to be
    copied because the subclass private data, child and parent pointers end up
    being shared between the original device and the copy.
    
    Add an epo_finish_copydevice which NULLs the three offending pointers, and
    then communicates to the caller that copying is not allowed.
    
    This also exposed a separate issue with the stype for subclasses devices.
    Devices are, I think, unique in having two stype objects associated with them:
    the usual one in the memory manager header, and the other stored in the device
    structere directly. In order for the stype to be correct, we have to use the
    stype for the incoming device, with the ssize of the original device (ssize
    should reflect the size of the memory allocation). We correctly did so with the
    stype in the device structure, but then used the prototype device's stype to
    patch the memory manager stype - meaning the ssize potentially no longer
    matched the allocated memory. This caused problems in the garbager where there
    is an implicit assumption that the size of a single object clump (c_alone == 1)
    is also the size (+ memory manager overheads) of the single object it contains.
    
    The solution is to use the same stype instance to patch the memory manager
    data as we do in the device structure (with the correct ssize).

base/gdevdflt.c
base/gdevepo.c



Ghostscript:

new scan-build warnings:

./base/gdevdflt.c:1371:9: warning: Function call argument is an uninitialized value
        gs_free_const_object(dev_to_subclass->memory->non_gc_memory, b_std, "gs_device_subclass(stype)");
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./base/gdevdflt.c:1387:9: warning: Function call argument is an uninitialized value
        gs_free_const_object(dev_to_subclass->memory->non_gc_memory, b_std, "gs_device_subclass(stype)");
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./base/gdevdflt.c:1430:22: warning: 'b_std' may be used uninitialized in this function [-Wmaybe-uninitialized]
         b_std->ssize = a_std->ssize;
                      ^


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

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




GhostPCL:

new scan-build warnings:

./base/gdevdflt.c:1371:9: warning: Function call argument is an uninitialized value
        gs_free_const_object(dev_to_subclass->memory->non_gc_memory, b_std, "gs_device_subclass(stype)");
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./base/gdevdflt.c:1387:9: warning: Function call argument is an uninitialized value
        gs_free_const_object(dev_to_subclass->memory->non_gc_memory, b_std, "gs_device_subclass(stype)");
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./base/gdevdflt.c:1430:22: warning: 'b_std' may be used uninitialized in this function [-Wmaybe-uninitialized]
         b_std->ssize = a_std->ssize;
                      ^


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

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