Add libical (#2298)

This commit is contained in:
tsdgeos 2019-04-09 20:23:05 +02:00 committed by Abhishek Arya
parent 676071636c
commit e445a90d94
4 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# Copyright 2019 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 tsdgeos@gmail.com
RUN apt-get install --yes cmake
RUN git clone --depth 1 https://github.com/libical/libical.git
COPY build.sh $SRC
COPY libical_fuzzer.cc $SRC
WORKDIR libical

View File

@ -0,0 +1,6 @@
cmake . -DBUILD_SHARED_LIBS=OFF -DICAL_GLIB=False
make install -j$(nproc)
$CXX $CXXFLAGS -std=c++11 $SRC/libical_fuzzer.cc -lFuzzingEngine /usr/local/lib/libical.a -o $OUT/libical_fuzzer
find . -name *.ics -print | zip -q $OUT/libical_fuzzer_seed_corpus.zip -@

View File

@ -0,0 +1,44 @@
/*
# Copyright 2019 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.
#
################################################################################
*/
/*
Usage:
python infra/helper.py build_image libical
python infra/helper.py build_fuzzers --sanitizer undefined|address|memory libical
python infra/helper.py run_fuzzer libical libical_fuzzer
*/
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <libical/ical.h>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
char *ical_string = (char*)malloc(size + 1);
memcpy(ical_string, data, size);
ical_string[size] = '\0';
icalcomponent *component = icalparser_parse_string(ical_string);
icalcomponent_free(component);
free(ical_string);
return 0;
}

View File

@ -0,0 +1,8 @@
homepage: https://github.com/libical/libical
primary_contact: tsdgeos@gmail.com
auto_ccs:
- allen.d.winter@gmail.com
sanitizers:
- address
- memory
- undefined