Fix potential out of bounds read in qpkmhandler

Off-by-one bug in the validity test of the texture type field.

Change-Id: I46ded85a0ad93166aa886e71f0c391f27e79f64f
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
bb10
Eirik Aavitsland 2018-08-03 11:48:14 +02:00
parent 819cad6670
commit 7dfc3ed663
1 changed files with 1 additions and 1 deletions

View File

@ -92,7 +92,7 @@ QTextureFileData QPkmHandler::read()
// texture type
quint16 type = qFromBigEndian<quint16>(rawData + 6);
if (type > sizeof(typeMap)/sizeof(typeMap[0])) {
if (type >= sizeof(typeMap)/sizeof(typeMap[0])) {
qCDebug(lcQtGuiTextureIO, "Unknown compression format in PKM file %s", logName().constData());
return QTextureFileData();
}