1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include <QBuffer>
#include "VncServerClient.h"
#include "VncServerProtocol.h"
class VncServerProtocolTest : public VncServerProtocol
{
public:
VncServerProtocolTest(RfbVeyonAuth::Type authMethod, QIODevice* socket, VncServerClient* client) :
VncServerProtocol(socket, client),
m_authMethod(authMethod)
{
}
QVector<RfbVeyonAuth::Type> supportedAuthTypes() const override
{
return {m_authMethod};
}
void processAuthenticationMessage(VariantArrayMessage& message) override
{
Q_UNUSED(message)
}
void performAccessControl() override
{
}
private:
const RfbVeyonAuth::Type m_authMethod;
};
extern "C" int LLVMFuzzerTestOneInput(const char *data, size_t size)
{
if (size < 5)
{
return 0;
}
QBuffer buffer;
buffer.open(QIODevice::ReadWrite);
VncServerClient client;
VncServerProtocolTest protocol(RfbVeyonAuth::Type(data[0]), &buffer, &client);
client.setProtocolState(VncServerProtocol::State(data[1]));
client.setAuthState(VncServerClient::AuthState(data[2]));
client.setAccessControlState(VncServerClient::AccessControlState(data[3]));
buffer.write(QByteArray::fromRawData(data+4, size-4));
buffer.seek(0);
protocol.read();
return 0;
}
|