Skip to content

Commit c225402

Browse files
Merge branch 'google:master' into master
2 parents d023b07 + 915cd23 commit c225402

File tree

16 files changed

+218
-16
lines changed

16 files changed

+218
-16
lines changed

.github/workflows/benchmarks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- libxslt_xpath
3434
- mbedtls_fuzz_dtlsclient
3535
- mbedtls_fuzz_dtlsclient_7c6b0e
36+
- mruby_mruby_fuzzer_8c8bbd
3637
- openh264_decoder_fuzzer
3738
- openssl_x509
3839
- openthread_ot-ip6-send-fuzzer
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2019 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
################################################################################
16+
17+
FROM gcr.io/oss-fuzz-base/base-builder@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd
18+
RUN apt-get update && apt-get install -y build-essential ruby bison ninja-build \
19+
cmake zlib1g-dev libbz2-dev liblzma-dev
20+
RUN git clone \
21+
https://github.com/mruby/mruby
22+
RUN git clone --depth 1 https://github.com/bshastry/mruby_seeds.git mruby_seeds
23+
WORKDIR mruby
24+
COPY build.sh *.c *.options *.dict $SRC/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
commit: 8c8bbd94dce3b3eabcf72c674e690516c075b0ee
2+
commit_date: 2023-02-03T04:41:10+0000
3+
fuzz_target: mruby_fuzzer
4+
project: mruby
5+
type: bug
6+
unsupported_fuzzers:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash -eu
2+
# Copyright 2019 Google Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
################################################################################
17+
18+
# Instrument mruby
19+
(
20+
cd $SRC/mruby
21+
export LD=$CC
22+
export LDFLAGS="$CFLAGS -fPIE"
23+
24+
# No you cannot overwrite CC/CXX, otherwise afl++, libafl, etc. wont work!
25+
#LD=/usr/local/bin/clang CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++ rake -m || true
26+
rake -m || true
27+
28+
test -f $SRC/mruby/build/host/lib/libmruby.a
29+
30+
# build fuzzers
31+
FUZZ_TARGET=$SRC/mruby_fuzzer.c
32+
name=$(basename $FUZZ_TARGET .c)
33+
$CC -c $CFLAGS -Iinclude \
34+
${FUZZ_TARGET} -o $OUT/${name}.o
35+
$CXX $CXXFLAGS $OUT/${name}.o $LIB_FUZZING_ENGINE -lm \
36+
$SRC/mruby/build/host/lib/libmruby.a -o $OUT/${name}
37+
rm -f $OUT/${name}.o
38+
)
39+
40+
# dict
41+
cp $SRC/mruby.dict $OUT/mruby_fuzzer.dict
42+
43+
# seeds
44+
zip -rq $OUT/mruby_fuzzer_seed_corpus $SRC/mruby_seeds
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
keyword___ENCODING__="__ENCODING__"
2+
keyword___FILE__="__FILE__"
3+
keyword___LINE__="__LINE__"
4+
keyword_BEGIN="BEGIN"
5+
keyword_END="END"
6+
keyword_alias="alias"
7+
keyword_and="and"
8+
keyword_begin="begin"
9+
keyword_break="break"
10+
keyword_case="case"
11+
keyword_class="class"
12+
keyword_def="def"
13+
keyword_do="do"
14+
keyword_else="else"
15+
keyword_elsif="elsif"
16+
keyword_end="end"
17+
keyword_ensure="ensure"
18+
keyword_false="false"
19+
keyword_for="for"
20+
keyword_if="if"
21+
keyword_in="in"
22+
keyword_module="module"
23+
keyword_next="next"
24+
keyword_nil="nil"
25+
keyword_not="not"
26+
keyword_or="or"
27+
keyword_redo="redo"
28+
keyword_rescue="rescue"
29+
keyword_retry="retry"
30+
keyword_return="return"
31+
keyword_self="self"
32+
keyword_super="super"
33+
keyword_then="then"
34+
keyword_true="true"
35+
keyword_undef="undef"
36+
keyword_unless="unless"
37+
keyword_until="until"
38+
keyword_when="when"
39+
keyword_while="while"
40+
keyword_yield="yield"
41+
42+
operator_a=" !"
43+
operator_b=" ~"
44+
operator_c=" +"
45+
operator_d=" -"
46+
operator_e=" []"
47+
operator_f=" []="
48+
operator_g=" *"
49+
operator_h=" /"
50+
operator_i=" %"
51+
operator_j=" +-"
52+
operator_k=" >>"
53+
operator_l=" <<"
54+
operator_m=" &"
55+
operator_n=" ^"
56+
operator_o=" |"
57+
operator_p=" <="
58+
operator_q=" <>"
59+
operator_r=" >="
60+
operator_s=" <=>"
61+
operator_t=" =="
62+
operator_u=" ==="
63+
operator_v=" !="
64+
operator_w=" =~"
65+
operator_x=" !~"
66+
operator_y=" &&"
67+
operator_z=" ||"
68+
operator_aa=" .."
69+
operator_ab=" ..."
70+
operator_ac=" ?"
71+
operator_ad=" :"
72+
operator_ae=" ="
73+
operator_af=" %="
74+
operator_ag=" /="
75+
operator_ah=" -="
76+
operator_ai=" +="
77+
operator_aj=" |="
78+
operator_ak=" &="
79+
operator_al=" >>="
80+
operator_am=" <<="
81+
operator_an=" *="
82+
operator_ao=" &&="
83+
operator_ap=" ||="
84+
operator_aq=" **="
85+
operator_ar=" ^="
86+
operator_as=" not"
87+
operator_at=" or"
88+
operator_au=" and"
89+
operator_av=" if"
90+
operator_aw=" unless"
91+
operator_ax=" while"
92+
operator_ay=" until"
93+
operator_az=" begin"
94+
operator_ba=" end"
95+
96+
snippet_1eq1=" 1=1"
97+
snippet_dollar=" $1"
98+
snippet_at=" @a"
99+
snippet_symbol=" :a"
100+
snippet_array=" [1,2]"
101+
snippet_block=" 1.times{|x| x}"
102+
snippet_multi=" 1*1"
103+
104+
string_single_q=" 'a'"
105+
string_dbl_q=" \"a\""
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <stdlib.h>
2+
#include <string.h>
3+
#include <mruby.h>
4+
#include <mruby/compile.h>
5+
6+
int LLVMFuzzerTestOneInput(uint8_t *Data, size_t size) {
7+
if (size < 1) {
8+
return 0;
9+
}
10+
char *code = malloc(size+1);
11+
memcpy(code, Data, size);
12+
code[size] = '\0';
13+
mrb_state *mrb = mrb_open();
14+
mrb_load_string(mrb, code);
15+
mrb_close(mrb);
16+
free(code);
17+
return 0;
18+
}

fuzzers/gramatron/builder.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FROM $parent_image
1717

1818
# Install libstdc++ to use llvm_mode.
1919
RUN apt-get update && \
20-
apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \
20+
apt-get install -y wget libstdc++-10-dev libtool-bin automake flex bison \
2121
libglib2.0-dev libpixman-1-dev python3-setuptools unzip \
2222
apt-utils apt-transport-https ca-certificates joe curl \
2323
python3-dev gzip
@@ -32,14 +32,14 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /rustup.sh && \
3232
# Download libafl
3333
RUN git clone https://github.com/AFLplusplus/libafl_fuzzbench /libafl_fuzzbench && \
3434
cd /libafl_fuzzbench && \
35-
git checkout db32b7b8c1c0065a0cec2129b4dfe3897d1b9a4b && \
35+
git checkout b7fc9fd143daff0190fd623ed3a8b9fbc64cc00c && \
3636
git submodule update --init
3737

3838
# Compile libafl
3939
RUN cd /libafl_fuzzbench/ && unset CFLAGS && unset CXXFLAGS && \
4040
export CC=clang && export CXX=clang++ && \
4141
export LIBAFL_EDGES_MAP_SIZE=2621440 && \
42-
PATH="$PATH:/root/.cargo/bin/" cargo build --release
42+
PATH="/root/.cargo/bin:$PATH" cargo build --release -p gramatron
4343

4444
RUN wget https://gist.githubusercontent.com/andreafioraldi/e5f60d68c98b31665a274207cfd05541/raw/4da351a321f1408df566a9cf2ce7cde6eeab3904/empty_fuzzer_lib.c -O /empty_fuzzer_lib.c && \
4545
clang -c /empty_fuzzer_lib.c && \

fuzzers/gramatron/fuzzer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
allowed_benchmarks:
22
- quickjs_eval-2020-01-05
33
- php_php-fuzz-execute
4-
- mruby-2018-05-23
4+
- mruby_mruby_fuzzer_8c8bbd

fuzzers/grimoire/builder.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FROM $parent_image
1717

1818
# Install libstdc++ to use llvm_mode.
1919
RUN apt-get update && \
20-
apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \
20+
apt-get install -y wget libstdc++-10-dev libtool-bin automake flex bison \
2121
libglib2.0-dev libpixman-1-dev python3-setuptools unzip \
2222
apt-utils apt-transport-https ca-certificates joe curl \
2323
python3-dev gzip
@@ -32,14 +32,14 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /rustup.sh && \
3232
# Download libafl
3333
RUN git clone https://github.com/AFLplusplus/libafl_fuzzbench /libafl_fuzzbench && \
3434
cd /libafl_fuzzbench && \
35-
git checkout db32b7b8c1c0065a0cec2129b4dfe3897d1b9a4b && \
35+
git checkout b7fc9fd143daff0190fd623ed3a8b9fbc64cc00c && \
3636
git submodule update --init
3737

3838
# Compile libafl
3939
RUN cd /libafl_fuzzbench/ && unset CFLAGS && unset CXXFLAGS && \
4040
export CC=clang && export CXX=clang++ && \
4141
export LIBAFL_EDGES_MAP_SIZE=2621440 && \
42-
PATH="$PATH:/root/.cargo/bin/" cargo build --release
42+
PATH="/root/.cargo/bin:$PATH" cargo build --release -p grimoire
4343

4444
RUN wget https://gist.githubusercontent.com/andreafioraldi/e5f60d68c98b31665a274207cfd05541/raw/4da351a321f1408df566a9cf2ce7cde6eeab3904/empty_fuzzer_lib.c -O /empty_fuzzer_lib.c && \
4545
clang -c /empty_fuzzer_lib.c && \

fuzzers/grimoire/fuzzer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
allowed_benchmarks:
22
- quickjs_eval-2020-01-05
33
- php_php-fuzz-execute
4-
- mruby-2018-05-23
4+
- mruby_mruby_fuzzer_8c8bbd

fuzzers/nautilus/builder.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FROM $parent_image
1717

1818
# Install libstdc++ to use llvm_mode.
1919
RUN apt-get update && \
20-
apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \
20+
apt-get install -y wget libstdc++-10-dev libtool-bin automake flex bison \
2121
libglib2.0-dev libpixman-1-dev python3-setuptools unzip \
2222
apt-utils apt-transport-https ca-certificates joe curl \
2323
python3-dev gzip
@@ -32,14 +32,14 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /rustup.sh && \
3232
# Download libafl
3333
RUN git clone https://github.com/AFLplusplus/libafl_fuzzbench /libafl_fuzzbench && \
3434
cd /libafl_fuzzbench && \
35-
git checkout db32b7b8c1c0065a0cec2129b4dfe3897d1b9a4b && \
35+
git checkout b7fc9fd143daff0190fd623ed3a8b9fbc64cc00c && \
3636
git submodule update --init
3737

3838
# Compile libafl
3939
RUN cd /libafl_fuzzbench/ && unset CFLAGS && unset CXXFLAGS && \
4040
export CC=clang && export CXX=clang++ && \
4141
export LIBAFL_EDGES_MAP_SIZE=2621440 && \
42-
PATH="$PATH:/root/.cargo/bin/" cargo build --release
42+
PATH="/root/.cargo/bin:$PATH" cargo build --release -p nautilus
4343

4444
RUN wget https://gist.githubusercontent.com/andreafioraldi/e5f60d68c98b31665a274207cfd05541/raw/4da351a321f1408df566a9cf2ce7cde6eeab3904/empty_fuzzer_lib.c -O /empty_fuzzer_lib.c && \
4545
clang -c /empty_fuzzer_lib.c && \

fuzzers/nautilus/fuzzer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
allowed_benchmarks:
22
- quickjs_eval-2020-01-05
33
- php_php-fuzz-execute
4-
- mruby-2018-05-23
4+
- mruby_mruby_fuzzer_8c8bbd

fuzzers/nautilus/runner.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
FROM gcr.io/fuzzbench/base-image
1616

17+
RUN apt update && apt -y install libexpat1-dev zlib1g-dev
18+
1719
# This makes interactive docker runs painless:
1820
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/out"
1921
#ENV AFL_MAP_SIZE=2621440

fuzzers/token_level/builder.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FROM $parent_image
1717

1818
# Install libstdc++ to use llvm_mode.
1919
RUN apt-get update && \
20-
apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \
20+
apt-get install -y wget libstdc++-10-dev libtool-bin automake flex bison \
2121
libglib2.0-dev libpixman-1-dev python3-setuptools unzip \
2222
apt-utils apt-transport-https ca-certificates joe curl \
2323
python3-dev gzip
@@ -32,14 +32,14 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /rustup.sh && \
3232
# Download libafl
3333
RUN git clone https://github.com/AFLplusplus/libafl_fuzzbench /libafl_fuzzbench && \
3434
cd /libafl_fuzzbench && \
35-
git checkout db32b7b8c1c0065a0cec2129b4dfe3897d1b9a4b && \
35+
git checkout b7fc9fd143daff0190fd623ed3a8b9fbc64cc00c && \
3636
git submodule update --init
3737

3838
# Compile libafl
3939
RUN cd /libafl_fuzzbench/ && unset CFLAGS && unset CXXFLAGS && \
4040
export CC=clang && export CXX=clang++ && \
4141
export LIBAFL_EDGES_MAP_SIZE=2621440 && \
42-
PATH="$PATH:/root/.cargo/bin/" cargo build --release
42+
PATH="/root/.cargo/bin:$PATH" cargo build --release -p token_level
4343

4444
RUN wget https://gist.githubusercontent.com/andreafioraldi/e5f60d68c98b31665a274207cfd05541/raw/4da351a321f1408df566a9cf2ce7cde6eeab3904/empty_fuzzer_lib.c -O /empty_fuzzer_lib.c && \
4545
clang -c /empty_fuzzer_lib.c && \

fuzzers/token_level/fuzzer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
allowed_benchmarks:
22
- quickjs_eval-2020-01-05
33
- php_php-fuzz-execute
4-
- mruby-2018-05-23
4+
- mruby_mruby_fuzzer_8c8bbd

fuzzers/token_level/runner.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
FROM gcr.io/fuzzbench/base-image
1616

17+
RUN apt update && apt -y install libexpat1-dev zlib1g-dev
18+
1719
# This makes interactive docker runs painless:
1820
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/out"
1921
#ENV AFL_MAP_SIZE=2621440

0 commit comments

Comments
 (0)