From 8f622fef415cacb50f826268282a276502dcc607 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 17:47:31 +0200 Subject: Prevent a Coverity warning about a dangerous code path Coverity warns that we may access the gray array without initializing it. The array is initialized if d (the source image depth) is 8. However, when doing ordered dithering, we don't check that depth any more and just use the array. There are instead checks in place for the other dither modes; the one for ordered has been commented out before public history. So, for the love of kittens, put the check back. Change-Id: I1cc5ced8edbb626777e54e9f4e58f152c6b28ddc Reviewed-by: Gunnar Sletta Reviewed-by: Marc Mutz --- src/gui/image/qimage_conversions.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/gui/image') diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index f2f71b4bad..66fe9ec3a8 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -1047,8 +1047,7 @@ void dither_to_Mono(QImageData *dst, const QImageData *src, dst_data += dst_bpl; src_data += src_bpl; } - } else - /* (d == 8) */ { + } else if (d == 8) { for (int i=0; i