bmp/ico decoder: fail early for unsupported bit depths

All the normal bit depths are supported, so no point in trying to go
through the decoding code path for others. Avoids wide bitshift
warning for claimed depths > 32.

Pick-to: 5.15 5.12
Change-Id: I61b72dbbf9558ca28db46f8168339f8174e56997
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Eirik Aavitsland 2020-05-29 15:15:01 +02:00
parent 30571068b2
commit 6a2224fd58
2 changed files with 10 additions and 2 deletions

View File

@ -262,9 +262,13 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset,
depth = 8;
format = QImage::Format_Indexed8;
break;
default:
case 1:
depth = 1;
format = QImage::Format_Mono;
break;
default:
return false;
break;
}
if (depth != 32) {

View File

@ -491,8 +491,12 @@ QImage ICOReader::iconAt(int index)
case 4:
icoAttrib.depth = 8;
break;
default:
case 1:
icoAttrib.depth = 1;
break;
default:
return img;
break;
}
if (icoAttrib.depth == 32) // there's no colormap
icoAttrib.ncolors = 0;