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<=code_size && state==ImageDataBlock) { int code=accum&((1<