From 5f8002f6e2e27f7edd9e312dd856fd50c27681f7 Mon Sep 17 00:00:00 2001 From: zackcglee Date: Thu, 21 Nov 2024 23:50:01 +0900 Subject: [PATCH] [benchmark] add bc-2.0.0 and sonic-0.2.0 --- benchmark/bc/2.0.0/Dockerfile | 15 +++++ benchmark/bc/2.0.0/build.sh | 32 +++++++++ benchmark/bc/2.0.0/label.json | 67 +++++++++++++++++++ benchmark/sonic/0.2.0/Dockerfile | 15 +++++ benchmark/sonic/0.2.0/build.sh | 14 ++++ benchmark/sonic/0.2.0/label.json | 107 +++++++++++++++++++++++++++++++ 6 files changed, 250 insertions(+) create mode 100644 benchmark/bc/2.0.0/Dockerfile create mode 100755 benchmark/bc/2.0.0/build.sh create mode 100644 benchmark/bc/2.0.0/label.json create mode 100644 benchmark/sonic/0.2.0/Dockerfile create mode 100755 benchmark/sonic/0.2.0/build.sh create mode 100644 benchmark/sonic/0.2.0/label.json diff --git a/benchmark/bc/2.0.0/Dockerfile b/benchmark/bc/2.0.0/Dockerfile new file mode 100644 index 0000000..5be666f --- /dev/null +++ b/benchmark/bc/2.0.0/Dockerfile @@ -0,0 +1,15 @@ +FROM prosyslab/bug-bench-base + +RUN apt-get -y update +RUN apt-get -y install wget flex + +COPY build.sh $SRC +ENV PROGRAM=bc-2.0.0 + +ENV URL=https://github.com/prosyslab-warehouse/bc-2.0.0 +ENV GIT_REPO_NAME=bc + +RUN git clone $URL +RUN mv $GIT_REPO_NAME $PROGRAM + +WORKDIR $PROGRAM diff --git a/benchmark/bc/2.0.0/build.sh b/benchmark/bc/2.0.0/build.sh new file mode 100755 index 0000000..f15df13 --- /dev/null +++ b/benchmark/bc/2.0.0/build.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +if [[ $1 == "sparrow" ]]; then + ./configure + $SMAKE_BIN --init + $SMAKE_BIN -j + cp sparrow/bc/bc/*.i $SMAKE_OUT +elif [[ $1 == "infer" ]]; then + ./configure + $INFER_BIN capture -- make -j + mv infer-out $OUT +elif [[ $1 == "codeql" ]]; then + ./configure + $CODEQL_BIN database create --language=cpp --command="make" codeql-db + mv codeql-db $OUT +elif [[ $1 == "haechi" ]]; then + export CC=$GCLANG_BIN + export CFLAGS="-fno-discard-value-names -O0 -Xclang -disable-O0-optnone -g" + EXT_TARGET=bc/bc + ./configure + + $SMAKE_BIN --init + $SMAKE_BIN -j + cp sparrow/bc/bc/*.i $SMAKE_OUT + + $GET_BC_BIN $EXT_TARGET && + llvm-dis -o $EXT_TARGET.ll $EXT_TARGET.bc && + opt -mem2reg -S -o $HAECHI_OUT/$(basename $EXT_TARGET).ll $EXT_TARGET.ll +else + echo "Unknown build target" + exit 1 +fi diff --git a/benchmark/bc/2.0.0/label.json b/benchmark/bc/2.0.0/label.json new file mode 100644 index 0000000..83cfad8 --- /dev/null +++ b/benchmark/bc/2.0.0/label.json @@ -0,0 +1,67 @@ +[{ + "project": "bc", + "version": "2.0.0", + "file": "src/num.c", + "line": 337, + "type": "integer-overflow", + "CVE": null, + "report": null, + "patch": "https://github.com/gavinhoward/bc/commit/e396dff5929071da830a84b64405f7a7c8e0113e#diff-9938f3b22dd90f74cd08153d1d46047a19bf2cc6e919792018e31b4192b09fb0R338", + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/num.c#L337", + "source": { + "file": "src/read.c", + "line": 81, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/read.c#L81" + }, + "sink": { + "file": "src/num.c", + "line": 337, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/num.c#L337" + }, + "bug-trace": [{ + "file": "src/read.c", + "line": 81, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/read.c#L81", + "cmd": "fgetc" + }, { + "file": "src/read.c", + "line": 113, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/read.c#L113", + "cmd": "return" + }, { + "file": "src/read.c", + "line": 134, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/read.c#L134", + "cmd": "call" + }, { + "file": "src/program.c", + "line": 1728, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/program.c#L1728", + "cmd": "call" + }, { + "file": "src/program.c", + "line": 1758, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/program.c#L1758", + "cmd": "call" + }, { + "file": "src/program.c", + "line": 1152, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/program.c#L1152", + "cmd": "assign" + }, { + "file": "src/program.c", + "line": 1163, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/program.c#L1163", + "cmd": "call" + }, { + "file": "src/num.c", + "line": 1989, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/num.c#L1989", + "cmd": "call" + }, { + "file": "src/num.c", + "line": 337, + "code": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/num.c#L337", + "cmd": "add" + }] +}] diff --git a/benchmark/sonic/0.2.0/Dockerfile b/benchmark/sonic/0.2.0/Dockerfile new file mode 100644 index 0000000..1c231e6 --- /dev/null +++ b/benchmark/sonic/0.2.0/Dockerfile @@ -0,0 +1,15 @@ +FROM prosyslab/bug-bench-base + +RUN apt-get -y update +RUN apt-get -y install wget flex + +COPY build.sh $SRC +ENV PROGRAM=sonic-0.2.0 + +ENV URL=https://github.com/prosyslab-warehouse/sonic-0.2.0 +ENV GIT_REPO_NAME=sonic + +RUN git clone $URL +RUN mv $GIT_REPO_NAME $PROGRAM + +WORKDIR $PROGRAM diff --git a/benchmark/sonic/0.2.0/build.sh b/benchmark/sonic/0.2.0/build.sh new file mode 100755 index 0000000..fbb48eb --- /dev/null +++ b/benchmark/sonic/0.2.0/build.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +if [[ $1 == "sparrow" ]]; then + echo "not ready yet" +elif [[ $1 == "infer" ]]; then + echo "not ready yet" +elif [[ $1 == "codeql" ]]; then + echo "not ready yet" +elif [[ $1 == "haechi" ]]; then + echo "not ready yet" +else + echo "Unknown build target" + exit 1 +fi diff --git a/benchmark/sonic/0.2.0/label.json b/benchmark/sonic/0.2.0/label.json new file mode 100644 index 0000000..e0444f8 --- /dev/null +++ b/benchmark/sonic/0.2.0/label.json @@ -0,0 +1,107 @@ +[{ + "project": "sonic", + "version": "0.2.0", + "file": "sonic.c", + "line": 997, + "type": "integer-overflow", + "CVE": null, + "report": "https://github.com/waywardgeek/sonic/issues/50", + "patch": null, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0", + "source": { + "file": "wave.c", + "line": 94, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/wave.c#L94" + }, + "sink": { + "file": "sonic.c", + "line": 997, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L997" + }, + "bug-trace": [{ + "file": "wave.c", + "line": 94, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/wave.c#L94", + "cmd": "fread" + }, { + "file": "wave.c", + "line": 94, + "code": "https://github.com/prosyslab-warehouse/xsane-0.999/blob/master/src/xsane-save.c#L570", + "cmd": "return" + }, { + "file": "wave.c", + "line": 345, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/wave.c#L345", + "cmd": "return" + }, { + "file": "main.c", + "line": 44, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/main.c#L44", + "cmd": "call" + }, { + "file": "sonic.c", + "line": 1107, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L1107", + "cmd": "call" + }, { + "file": "sonic.c", + "line": 1058, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L1058", + "cmd": "call" + }, { + "file": "sonic.c", + "line": 1028, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L1028", + "cmd": "call" + }, { + "file": "sonic.c", + "line": 698, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L698", + "cmd": "call" + }, { + "file": "sonic.c", + "line": 622, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L622", + "cmd": "assign" + }, { + "file": "sonic.c", + "line": 646, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L646", + "cmd": "return" + }, { + "file": "sonic.c", + "line": 726, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L726", + "cmd": "assign" + }, { + "file": "sonic.c", + "line": 730, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L730", + "cmd": "return" + }, { + "file": "sonic.c", + "line": 1028, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L1028", + "cmd": "assign" + }, { + "file": "sonic.c", + "line": 1033, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L1033", + "cmd": "call" + }, { + "file": "sonic.c", + "line": 994, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L994", + "cmd": "assign" + }, { + "file": "sonic.c", + "line": 997, + "code": "https://github.com/prosyslab-warehouse/sonic-0.2.0/blob/master/sonic.c#L997", + "cmd": "add" + }], + "similarity": [{ + "ID": "bc-2.0.0", + "bug": "https://github.com/prosyslab-warehouse/bc-2.0.0/blob/master/src/num.c#L337", + "score": 0.7 + }] +}]