Skip to content

Commit

Permalink
[benchmark] add bc-2.0.0 and sonic-0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
spearo2 committed Nov 21, 2024
1 parent f90fe9b commit 5f8002f
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 0 deletions.
15 changes: 15 additions & 0 deletions benchmark/bc/2.0.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions benchmark/bc/2.0.0/build.sh
Original file line number Diff line number Diff line change
@@ -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
67 changes: 67 additions & 0 deletions benchmark/bc/2.0.0/label.json
Original file line number Diff line number Diff line change
@@ -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"
}]
}]
15 changes: 15 additions & 0 deletions benchmark/sonic/0.2.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions benchmark/sonic/0.2.0/build.sh
Original file line number Diff line number Diff line change
@@ -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
107 changes: 107 additions & 0 deletions benchmark/sonic/0.2.0/label.json
Original file line number Diff line number Diff line change
@@ -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
}]
}]

0 comments on commit 5f8002f

Please sign in to comment.