diff options
author | Mike Aizatsky <mike.aizatsky@gmail.com> | 2016-11-29 10:55:25 -0800 |
---|---|---|
committer | Mike Aizatsky <mike.aizatsky@gmail.com> | 2016-11-29 10:55:25 -0800 |
commit | a143b9b39a51412d133f846688194d68fe4197ba (patch) | |
tree | 936eb7e6c320fb7066f0da416727ebab8ce4668c /projects/libass | |
parent | 330c900781b1a8abde12e5478bb85854da48afc2 (diff) | |
download | oss-fuzz-a143b9b39a51412d133f846688194d68fe4197ba.tar.gz |
[infra] renaming targets/ to projects/
Diffstat (limited to 'projects/libass')
-rw-r--r-- | projects/libass/Dockerfile | 24 | ||||
-rw-r--r-- | projects/libass/ass.dict | 112 | ||||
-rwxr-xr-x | projects/libass/build.sh | 36 | ||||
-rw-r--r-- | projects/libass/libass_fuzzer.cc | 49 | ||||
-rw-r--r-- | projects/libass/libass_fuzzer.options | 2 | ||||
-rw-r--r-- | projects/libass/target.yaml | 1 |
6 files changed, 224 insertions, 0 deletions
diff --git a/projects/libass/Dockerfile b/projects/libass/Dockerfile new file mode 100644 index 000000000..1fd7c92e5 --- /dev/null +++ b/projects/libass/Dockerfile @@ -0,0 +1,24 @@ +# Copyright 2016 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 ossfuzz/base-libfuzzer +MAINTAINER eugeni.stepanov@gmail.com +RUN apt-get install -y make autoconf automake libtool pkg-config libfreetype6-dev libfontconfig1-dev + +RUN git clone https://github.com/libass/libass.git +RUN git clone https://github.com/behdad/fribidi.git + +COPY build.sh libass_fuzzer.cc *.dict *.options $SRC/ diff --git a/projects/libass/ass.dict b/projects/libass/ass.dict new file mode 100644 index 000000000..aa4f9b43f --- /dev/null +++ b/projects/libass/ass.dict @@ -0,0 +1,112 @@ +"0x" +"\\1a" +"\\2a" +"\\2c" +"\\3a" +"\\3c" +"\\4a" +"\\4c" +"\\a" +"\\alpha" +"\\an" +"Arial" +"\\b" +"Banner;" +"\\be" +"\\blur" +"\\bord" +"\\c" +"CFF" +"CID Type 1" +"\\clip" +"clip" +"Courier" +"Courier New" +"Default" +"Dialogue:" +"[Events]" +"\\fade" +"\\fax" +"\\fay" +"\\fe" +"\\fn" +"fontname:" +"[Fonts]" +"Format:" +"\\frx" +"\\fry" +"\\frz" +"\\fs" +"\\fsc" +"\\fscx" +"\\fscy" +"\\fsp" +"&h" +"Helvetica" +"\\i" +"\\iclip" +"iclip" +"\\k" +"Kerning:" +"Kerning" +"\\kf" +"\\ko" +"Language:" +"monospace" +"\\move" +"move" +"none" +"\\org" +"org" +"OverrideStyle" +"\\p" +"p" +"\\pbo" +"pbo" +"pc.240m" +"pc.601" +"pc.709" +"pc.fcc" +"PlayResX:" +"PlayResX" +"PlayResY:" +"PlayResY" +"\\pos" +"pos" +"\\q" +"\\r" +"\\s" +"sans-serif" +"ScaledBorderAndShadow:" +"ScaledBorderAndShadow" +"[Script Info]" +"Scroll down;" +"Scroll up;" +"serif" +"\\shad" +"Style:" +"\\t" +"Text" +"Timer:" +"Timer" +"Times" +"Times New Roman" +"tv.240m" +"tv.601" +"tv.709" +"tv.fcc" +"Type 1" +"Type 42" +"\\u" +"UTF-8" +"[V4 Styles]" +"[V4+ Styles]" +"WrapStyle:" +"WrapStyle" +"\\xbord" +"\\xshad" +"\\ybord" +"YCbCr Matrix:" +"YCbCr Matrix" +"yes" +"\\yshad" diff --git a/projects/libass/build.sh b/projects/libass/build.sh new file mode 100755 index 000000000..07db7d05e --- /dev/null +++ b/projects/libass/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash -eux +# Copyright 2016 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. +# +################################################################################ + +cd $SRC/fribidi +./bootstrap +./configure --enable-static=yes --enable-shared=no --with-pic=yes +# Don't run "make": it's broken. Run "make install". +make install + +cd $SRC/libass + +./autogen.sh +./configure --disable-asm +make -j$(nproc) + +$CXX $CXXFLAGS -std=c++11 -I$SRC/libass \ + $SRC/libass_fuzzer.cc -o $OUT/libass_fuzzer \ + -lfuzzer libass/.libs/libass.a \ + -Wl,-Bstatic -lfontconfig -lfribidi -lfreetype -lz -lpng12 \ + -lexpat -Wl,-Bdynamic + +cp $SRC/*.dict $SRC/*.options $OUT/ diff --git a/projects/libass/libass_fuzzer.cc b/projects/libass/libass_fuzzer.cc new file mode 100644 index 000000000..5254faff4 --- /dev/null +++ b/projects/libass/libass_fuzzer.cc @@ -0,0 +1,49 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <libass/ass.h> + +static ASS_Library *ass_library; +static ASS_Renderer *ass_renderer; + +void msg_callback(int level, const char *fmt, va_list va, void *data) { +} + +static const int kFrameWidth = 1280; +static const int kFrameHeight = 720; + +static bool init(int frame_w, int frame_h) { + ass_library = ass_library_init(); + if (!ass_library) { + printf("ass_library_init failed!\n"); + exit(1); + } + + ass_set_message_cb(ass_library, msg_callback, NULL); + + ass_renderer = ass_renderer_init(ass_library); + if (!ass_renderer) { + printf("ass_renderer_init failed!\n"); + exit(1); + } + + ass_set_frame_size(ass_renderer, frame_w, frame_h); + ass_set_fonts(ass_renderer, nullptr, "sans-serif", + ASS_FONTPROVIDER_AUTODETECT, nullptr, 1); + return true; +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + static bool initialized = init(kFrameWidth, kFrameHeight); + + ASS_Track *track = ass_read_memory(ass_library, (char *)data, size, nullptr); + if (!track) return 0; + + for (int i = 0; i < track->n_events; ++i) { + ASS_Event &ev = track->events[i]; + long long tm = ev.Start + ev.Duration / 2; + ass_render_frame(ass_renderer, track, tm, nullptr); + } + ass_free_track(track); + return 0; +} diff --git a/projects/libass/libass_fuzzer.options b/projects/libass/libass_fuzzer.options new file mode 100644 index 000000000..6a3e33bc3 --- /dev/null +++ b/projects/libass/libass_fuzzer.options @@ -0,0 +1,2 @@ +[libfuzzer] +dict = ass.dict diff --git a/projects/libass/target.yaml b/projects/libass/target.yaml new file mode 100644 index 000000000..6289bce16 --- /dev/null +++ b/projects/libass/target.yaml @@ -0,0 +1 @@ +homepage: "https://github.com/libass/libass" |