From: Tony Cook Date: Tue, 1 Jan 2019 01:04:30 +0000 (+1100) Subject: Coverity complained colors could be left uninitialized. X-Git-Tag: v1.009~33 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/eb7e48c9e5cc5ae4302002753b0b6b7b53f815e4 Coverity complained colors could be left uninitialized. --- diff --git a/Changes b/Changes index 2554022b..bfb3c680 100644 --- a/Changes +++ b/Changes @@ -37,6 +37,10 @@ Coverity finally finished a build, fix a few problems: that function with inconsistent parameters, but a belt-and-suspenders check was added. + - Coverity complained a call to i_getcolors(), used by the + implementation of the is_bilevel() method could leave the fetched + colors uninitialized. Added a return value check. + Imager 1.008 - 31 Dec 2018 ============ diff --git a/image.c b/image.c index 3329003f..cdfa2ed4 100644 --- a/image.c +++ b/image.c @@ -1802,7 +1802,8 @@ i_img_is_monochrome(i_img *im, int *zero_is_white) { if (im->type == i_palette_type && i_colorcount(im) == 2) { i_color colors[2]; - i_getcolors(im, 0, colors, 2); + if (!i_getcolors(im, 0, colors, 2)) + return 0; if (im->channels == 3) { if (colors[0].rgb.r == 255 && colors[0].rgb.g == 255 &&