Skip to content

Commit

Permalink
ico image handler: check for out of range image size
Browse files Browse the repository at this point in the history
Make the decoder fail early to avoid spending time and memory on
attempting to decode a corrupt image file.

Change-Id: I598db817c387867a449040f5be5427c8b8746483
Reviewed-by: Lars Knoll <[email protected]>
  • Loading branch information
aavit committed Dec 3, 2018
1 parent 416b4cf commit 4931973
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/plugins/imageformats/ico/qicohandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ QImage ICOReader::iconAt(int index)
icoAttrib.h = iconEntry.bHeight;
if (icoAttrib.h == 0) // means 256 pixels
icoAttrib.h = header.biHeight/2;
if (icoAttrib.w > 256 || icoAttrib.h > 256) // Max ico size
return img;

QImage::Format format = QImage::Format_ARGB32;
if (icoAttrib.nbits == 24)
Expand Down

0 comments on commit 4931973

Please sign in to comment.