Skip to content

Commit

Permalink
fuzz: http_request workaround for libevent < 2.1.1
Browse files Browse the repository at this point in the history
Before libevent 2.1.1, internal functions names didn't end with an underscore.
  • Loading branch information
theStack committed Apr 17, 2020
1 parent c189bfd commit 6f8b498
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/fuzz/http_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <test/fuzz/util.h>

#include <event2/buffer.h>
#include <event2/event.h>
#include <event2/http.h>
#include <event2/http_struct.h>

Expand All @@ -17,8 +18,24 @@
#include <string>
#include <vector>

// workaround for libevent versions before 2.1.1,
// when internal functions didn't have underscores at the end
#if LIBEVENT_VERSION_NUMBER < 0x02010100
extern "C" int evhttp_parse_firstline(struct evhttp_request*, struct evbuffer*);
extern "C" int evhttp_parse_headers(struct evhttp_request*, struct evbuffer*);
inline int evhttp_parse_firstline_(struct evhttp_request* r, struct evbuffer* b)
{
return evhttp_parse_firstline(r, b);
}
inline int evhttp_parse_headers_(struct evhttp_request* r, struct evbuffer* b)
{
return evhttp_parse_headers(r, b);
}
#else
extern "C" int evhttp_parse_firstline_(struct evhttp_request*, struct evbuffer*);
extern "C" int evhttp_parse_headers_(struct evhttp_request*, struct evbuffer*);
#endif

std::string RequestMethodString(HTTPRequest::RequestMethod m);

void test_one_input(const std::vector<uint8_t>& buffer)
Expand Down

0 comments on commit 6f8b498

Please sign in to comment.