New Ghostscript/GhostPDL compiler warnings - 2018-08-24-09:00:02 - 5516c614dc33662a2afdc377159f70218e67bde5

[email protected] Fri, 24 Aug 2018 10:19:57 -0700 (PDT)
Newsgroups gmane.comp.printing.ghostscript.regression
Message-ID <20180824171957.7E7F92040510@i7>
Previous Revision: b0a3854751363657998d4c9bd33c290bf9d07c67
 Current Revision: 5516c614dc33662a2afdc377159f70218e67bde5

commit 5516c614dc33662a2afdc377159f70218e67bde5
Author:     Chris Liddell <[email protected]>
AuthorDate: Fri Aug 24 09:26:04 2018 +0100
CommitDate: Fri Aug 24 14:36:48 2018 +0100

    Improve restore robustness
    
    Prompted by looking at Bug 699654:
    
    There are two variants of the restore operator in Ghostscript: one is Level 1
    (restoring VM), the other is Level 2+ (adding page device restoring to the
    Level operator).
    
    This was implemented by the Level 2+ version restoring the device in the
    graphics state, then calling the Level 1 implementation to handle actually
    restoring the VM state.
    
    The problem was that the operand checking, and sanity of the save object was
    only done by the Level 1 variant, thus meaning an invalid save object could
    leave a (Level 2+) restore partially complete - with the page device part
    restored, but not VM, and the page device not configured.
    
    To solve that, this commit splits the operand and sanity checking, and the
    core of the restore operation into separate functions, so the relevant
    operators can validate the operand *before* taking any further action. That
    reduces the chances of an invalid restore leaving the interpreter in an
    unknown state.
    
    If an error occurs during the actual VM restore it is essentially fatal, and the
    interpreter cannot continue, but as an extra surety for security, in the event
    of such an error, we'll explicitly preserve the LockSafetyParams of the device,
    rather than rely on the post-restore device configuration (which won't happen
    in the event of an error).

psi/int.mak
psi/isave.h
psi/zdevice2.c
psi/zvmem.c



Ghostscript:

new gcc warnings (gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609): 

./psi/zvmem.c:146:12: warning: unused variable 'op' [-Wunused-variable]

http://miles.ghostscript.com:8080/artifex/5516c614dc33662a2afdc377159f70218e67bde5/gs-gcc-warnings.txt



new clang warnings (clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)): 

./psi/zvmem.c:146:12: warning: unused variable 'op' [-Wunused-variable]
    os_ptr op = osp;
           ^


http://miles.ghostscript.com:8080/artifex/5516c614dc33662a2afdc377159f70218e67bde5/gs-clang-warnings.txt



new scan-build warnings:

./psi/zvmem.c:122:21: warning: Function call argument is an uninitialized value
        if ((code = restore_check_stack(i_ctx_p, &o_stack, *asave, false)) < 0 ||
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./psi/zvmem.c:146:12: warning: Value stored to 'op' during its initialization is never read
    os_ptr op = osp;
           ^~   ~~~

./psi/zvmem.c:146:12: warning: unused variable 'op' [-Wunused-variable]
     os_ptr op = osp;
            ^


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

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