File: main.cpp

package info (click to toggle)
veyon 4.9.5%2Brepack1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 14,032 kB
  • sloc: cpp: 51,739; ansic: 7,307; python: 228; makefile: 222; sh: 48
file content (58 lines) | stat: -rw-r--r-- 1,184 bytes parent folder | download | duplicates (3)
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;
}