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 <gunnar@sletta.org>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
Giuseppe D'Angelo 2014-09-20 17:47:31 +02:00
parent fb8c795302
commit 8f622fef41
1 changed files with 1 additions and 2 deletions

View File

@ -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<h; i++) {
const uchar *p = src_data;
const uchar *end = p + w;