libreoffice-online/fuzzer/Admin.cpp
Miklos Vajna c65d8e7c7f HttpRequest: add missing config.h include
fuzzers build was failing with:

	In file included from fuzzer/Admin.cpp:3:
	In file included from ./wsd/Admin.hpp:12:
	In file included from ./wsd/AdminModel.hpp:20:
	In file included from ./net/WebSocketHandler.hpp:18:
	./net/HttpRequest.hpp:667:31: error: expected ')'
		_header.add("Server", HTTP_SERVER_STRING);
				      ^
	./common/Common.hpp:62:51: note: expanded from macro 'HTTP_SERVER_STRING'
	#define HTTP_SERVER_STRING "LOOLWSD HTTP Server " LOOLWSD_VERSION
							  ^
	./net/HttpRequest.hpp:667:20: note: to match this '('
		_header.add("Server", HTTP_SERVER_STRING);
			   ^

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ibc3905e3e62e0eb9788b750971916ff4a4937f12
2021-03-30 12:23:09 +02:00

24 lines
608 B
C++

#include <iostream>
#include "config.h"
#include "Admin.hpp"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
Admin& admin = Admin::instance();
auto handler = std::make_shared<AdminSocketHandler>(&admin);
std::string input(reinterpret_cast<const char*>(data), size);
std::stringstream ss(input);
std::string line;
while (std::getline(ss, line, '\n'))
{
std::vector<char> lineVector(line.data(), line.data() + line.size());
handler->handleMessage(lineVector);
}
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */