New Ghostscript/GhostPDL compiler warnings - 2017-11-21-21:30:02 - 362ec9daadb9992b0def3520cd1dc6fa52edd1c4

[email protected]
Newsgroups gmane.comp.printing.ghostscript.regression
Message-ID <20171122073706.3AC4720401BA@i7>
Previous Revision: 68fa913b5bc06a4250115f52835cadc5493aab12
 Current Revision: 362ec9daadb9992b0def3520cd1dc6fa52edd1c4

commit 362ec9daadb9992b0def3520cd1dc6fa52edd1c4
Author:     Ray Johnston <[email protected]>
AuthorDate: Tue Nov 21 12:48:54 2017 -0800
CommitDate: Tue Nov 21 21:27:19 2017 -0800

    Fix bug 697459 Buffer overflow in fill_threshold_buffer
    
    There was an overflow check for ht_buffer size, but none for the larger
    threshold_buffer. Note that this file didn't fail on Windows because the
    combination of the ht_buffer and the size of the (miscalculated due to
    overflow) threshold_buffer would have exceeded the 2Gb limit.

base/gxht_thresh.c
base/gxipixel.c



Ghostscript:

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

./base/gxht_thresh.c:716:42: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        if (penum->ht_stride * spp_out > max_int / max_height)
                                         ^~~~~~~
./base/std.h:66:19: note: expanded from macro 'max_int'
#define max_int (~min_int)
                  ^~~~~~~
./base/std.h:65:21: note: expanded from macro 'min_int'
#define min_int (-1 << (ARCH_SIZEOF_INT * 8 - 1))
                 ~~ ^

./base/gxht_thresh.c:739:32: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        if (penum->line_size > max_int / max_height) {
                               ^~~~~~~
./base/std.h:66:19: note: expanded from macro 'max_int'
#define max_int (~min_int)
                  ^~~~~~~
./base/std.h:65:21: note: expanded from macro 'min_int'
#define min_int (-1 << (ARCH_SIZEOF_INT * 8 - 1))
                 ~~ ^


http://miles.ghostscript.com:8080/artifex/362ec9daadb9992b0def3520cd1dc6fa52edd1c4/gs-clang-warnings.txt



new cppcheck warnings (Cppcheck 1.72): 

base/gxht_thresh.c:716: error: Shifting a negative value is undefined behaviour
base/gxht_thresh.c:739: error: Shifting a negative value is undefined behaviour

http://miles.ghostscript.com:8080/artifex/362ec9daadb9992b0def3520cd1dc6fa52edd1c4/gs-cppcheck.txt
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.