Closed Medowhill closed 4 years ago
Hi.
According to the C-Reduce document, it seems that exit code 0 means a reduced program is desirable.
0
Next we need an interestingness test: a program that returns 0 if a partially-reduced test case is desirable, and returns non-zero otherwise.
After the latest update, cargo run --bin fuzz exits with 102 when GCC fails or the created binary runs forever.
cargo run --bin fuzz
102
However, the current reduce criteria use the following to determine the exit code:
! cargo run --manifest-path $PROJECT_DIR/Cargo.toml --release --bin fuzz -- $FUZZ_ARG test_reduced.c
Therefore, when cargo run --bin fuzz exits with 102, a reduced program is considered as a desirable one. Actually, I got the following after reducing:
int main() { for (;;) ; }
I believe that the following fix can resolve this issue:
--- a/tests/reduce-criteria-template.sh +++ b/tests/reduce-criteria-template.sh @@ -49,10 +50,16 @@ if grep 'excess elements in struct initializer' outa.txt ||\ grep 'comparison between pointer and integer' outa.txt ||\ ! gcc -O1 test_reduced.c > cc_out1.txt 2>&1 ||\ - ! gcc -O2 test_reduced.c > cc_out2.txt 2>&1) + ! gcc -O2 test_reduced.c > cc_out2.txt 2>&1 ||\ + ! cargo run --manifest-path $PROJECT_DIR/Cargo.toml --release -- --parse test_reduced.c >/dev/null 2>&1) then exit 1 fi -cargo run --manifest-path $PROJECT_DIR/Cargo.toml --release -- --parse test_reduced.c >/dev/null 2>&1 &&\ -! cargo run --manifest-path $PROJECT_DIR/Cargo.toml --release --bin fuzz -- $FUZZ_ARG test_reduced.c +cargo run --manifest-path $PROJECT_DIR/Cargo.toml --release --bin fuzz -- $FUZZ_ARG test_reduced.c +if [ "$?" = 101 ] +then + exit 0 +else + exit 1 +fi
Thank you.
Great suggestion! I will fix it soon. Thank you :)
It has been fixed by the latest commit. Thank you!
Hi.
According to the C-Reduce document, it seems that exit code
0
means a reduced program is desirable.After the latest update,
cargo run --bin fuzz
exits with102
when GCC fails or the created binary runs forever.However, the current reduce criteria use the following to determine the exit code:
Therefore, when
cargo run --bin fuzz
exits with102
, a reduced program is considered as a desirable one. Actually, I got the following after reducing:I believe that the following fix can resolve this issue:
Thank you.