mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
ora:kra: qstrcmp -> memcmp
i..e don't check strings but memory Makes oss-fuzz happier. Reviewers: svuorela Reviewed By: svuorela Subscribers: apol, pino, security-team, rempt, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D20143
This commit is contained in:
parent
a24ece396a
commit
fd4fb6f596
@ -18,6 +18,9 @@
|
|||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
static constexpr char s_magic[] = "application/x-krita";
|
||||||
|
static constexpr int s_magic_size = strlen(s_magic);
|
||||||
|
|
||||||
KraHandler::KraHandler()
|
KraHandler::KraHandler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -55,7 +58,7 @@ bool KraHandler::canRead(QIODevice *device)
|
|||||||
|
|
||||||
char buff[57];
|
char buff[57];
|
||||||
if (device->peek(buff, sizeof(buff)) == sizeof(buff))
|
if (device->peek(buff, sizeof(buff)) == sizeof(buff))
|
||||||
return qstrcmp(buff + 0x26, "application/x-krita") == 0;
|
return memcmp(buff + 0x26, s_magic, s_magic_size) == 0;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
#include <kzip.h>
|
#include <kzip.h>
|
||||||
|
|
||||||
|
static constexpr char s_magic[] = "image/openraster";
|
||||||
|
static constexpr int s_magic_size = strlen(s_magic);
|
||||||
|
|
||||||
OraHandler::OraHandler()
|
OraHandler::OraHandler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -54,7 +57,7 @@ bool OraHandler::canRead(QIODevice *device)
|
|||||||
|
|
||||||
char buff[54];
|
char buff[54];
|
||||||
if (device->peek(buff, sizeof(buff)) == sizeof(buff))
|
if (device->peek(buff, sizeof(buff)) == sizeof(buff))
|
||||||
return qstrcmp(buff + 0x26, "image/openraster") == 0;
|
return memcmp(buff + 0x26, s_magic, s_magic_size) == 0;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user