]> git.imager.perl.org - imager.git/commitdiff
Coverity complained colors could be left uninitialized.
authorTony Cook <tony@develop-help.com>
Tue, 1 Jan 2019 01:04:30 +0000 (12:04 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 1 Jan 2019 01:04:30 +0000 (12:04 +1100)
Changes
image.c

diff --git a/Changes b/Changes
index 2554022b03ce0bdd9bb11773a4ca721208862ccf..bfb3c680318a6fee5eb9cbc43502a031f982a94a 100644 (file)
--- 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 3329003fdda11f951e5cc0d361a370f5a2d63e71..cdfa2ed4aaa1a5575b239be374c7d667d4d84dee 100644 (file)
--- 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 &&