summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats/gif
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2020-05-29 11:09:22 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2020-05-30 12:32:56 +0200
commit30571068b203a9d950030b31ee84f08f2f6fc04d (patch)
tree065ed3bb3d7e0735f58b61972160856c174bee32 /src/plugins/imageformats/gif
parent10a0dc6600ac039ca94defc461d7b1c714d86387 (diff)
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>
Diffstat (limited to 'src/plugins/imageformats/gif')
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index d45ebfb314..c0af900656 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -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