[libevent] Initial Integration (#3960)

* add libevent project

* edit indentations and add primary contact

* Fix indents

* Fix indents

Co-authored-by: Abhishek Arya <inferno@chromium.org>
This commit is contained in:
Google AutoFuzz Team 2020-06-10 21:32:24 +02:00 committed by GitHub
parent 39dbb1c807
commit af42169e03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER a3at.mail@gmail.com
RUN apt-get update && apt-get install -y make autoconf automake libtool cmake
RUN git clone --depth 1 https://github.com/libevent/libevent.git libevent
WORKDIR libevent
COPY build.sh *.cc $SRC/

32
projects/libevent/build.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash -eu
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
# build project
sh autogen.sh
./configure --disable-openssl
make -j$(nproc) clean
make -j$(nproc) all
make install
# build fuzzer
for fuzzers in $(find $SRC -name '*_fuzzer.cc'); do
fuzz_basename=$(basename -s .cc $fuzzers)
$CXX $CXXFLAGS -std=c++11 -Iinclude \
$fuzzers $LIB_FUZZING_ENGINE ./.libs/libevent.a ./.libs/libevent_core.a \
./.libs/libevent_pthreads.a ./.libs/libevent_extra.a \
-o $OUT/$fuzz_basename
done

View File

@ -0,0 +1,28 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string>
#include "libevent/include/event2/http.h"
#include "libevent/include/event2/keyvalq_struct.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
std::string fuzz_string(reinterpret_cast<const char *>(data), size);
struct evkeyvalq headers;
evhttp_parse_query(fuzz_string.c_str(), &headers);
return 0;
}

View File

@ -0,0 +1,10 @@
homepage: "https://github.com/libevent/libevent"
language: c++
primary_contact: "a3at.mail@gmail.com"
sanitizers:
- address
- memory
- undefined
architectures:
- x86_64
- i386