Gif decoder: avoid undefined values in enum

The gif standard allocates 3 bits for the disposal method, but values
4-7 are unused.

Pick-to: 5.15 5.12
Change-Id: I0f70b3f87b4cd8e98140c3da476702a22ebe93a9
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Eirik Aavitsland 2020-05-29 11:09:22 +02:00
parent 10a0dc6600
commit 30571068b2

View File

@ -629,7 +629,8 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
count++;
if (count==hold[0]+1) {
disposePrevious(image);
disposal=Disposal((hold[1]>>2)&0x7);
uint dBits = (hold[1] >> 2) & 0x7;
disposal = (dBits <= RestoreImage) ? Disposal(dBits) : NoDisposal;
//UNUSED: waitforuser=!!((hold[1]>>1)&0x1);
int delay=count>3 ? LM(hold[2], hold[3]) : 1;
// IE and mozilla use a minimum delay of 10. With the minimum delay of 10