From 7dfc3ed663d3f01568f18b204af5ea102c582979 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 3 Aug 2018 11:48:14 +0200 Subject: [PATCH] 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 --- src/gui/util/qpkmhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/util/qpkmhandler.cpp b/src/gui/util/qpkmhandler.cpp index 4481deaa8e..e0c3b75efe 100644 --- a/src/gui/util/qpkmhandler.cpp +++ b/src/gui/util/qpkmhandler.cpp @@ -92,7 +92,7 @@ QTextureFileData QPkmHandler::read() // texture type quint16 type = qFromBigEndian(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(); }