summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats/gif
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/imageformats/gif')
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index 23a768e3d3..7ef0d076bb 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -492,12 +492,14 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
break;
case ImageDataBlock:
count++;
- if (bitcount < 0 || bitcount > 31) {
- state = Error;
- return -1;
+ if (bitcount != -32768) {
+ if (bitcount < 0 || bitcount > 31) {
+ state = Error;
+ return -1;
+ }
+ accum |= (ch << bitcount);
+ bitcount += 8;
}
- accum|=(ch<<bitcount);
- bitcount+=8;
while (bitcount>=code_size && state==ImageDataBlock) {
int code=accum&((1<<code_size)-1);
bitcount-=code_size;