xpm image format: Reject corrupt images with invalid header info

The xpm handler did not properly check that the information read from
the file header was sane.

Task-number: QTBUG-59211
Change-Id: I84099777a16b2b0c473d139f5fdec1d0cb5d515e
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Eirik Aavitsland 2017-03-01 12:21:29 +01:00
parent 2f10a6f04e
commit 0d287500be

View File

@ -852,6 +852,9 @@ static bool read_xpm_header(
#endif
return false; // < 4 numbers parsed
if (*w <= 0 || *w > 32767 || *h <= 0 || *h > 32767 || *ncols <= 0 || *ncols > (64 * 64 * 64 * 64) || *cpp <= 0 || *cpp > 15)
return false; // failed sanity check
return true;
}