Closed geeknik closed 7 years ago
Thanks for reporting this @geeknik! That is a lot of issues, could you please merge them all into one issue? It will be easier to track, and it does seem that all errors come from the same function, transformSequences().
Also, could you please give me more information on how you exactly compiled the code? I have never worked with afl-clang-fast++ and ASan, so having exact commands that you used will help a lot in reproducing the problem.
You can download AFL here. Then I compiled edlib like so:
CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 cmake ..
followed by
CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 make
And then I just used your test-data as a starting point:
AFL_PRELOAD=/root/afl-2.39b/libdislocator/libdislocator.so afl-fuzz -m none -i ~/edlib/test_data/E_coli_DH1/ -o out ./edlib-aligner -p @@ @@
Ok, awesome! I will check this out in the next few days - if you already have some ideas on what is causing the issue, you are welcome to write them down or even create a PR.
Actually the main piece of code is written in cpp, so I believe CXX is also needed.
I am guessing the problem is that query and target contain character codes that are not in the range of [0, 127]
. I didn't do much to protect against such situation except for providing comments:
* @param [in] query First sequence. Character codes should be in range [0, 127].
* @param [in] target Second sequence. Character codes should be in range [0, 127].
I will investigate further later to see if this is the cause and if yes, how best to fix it.
@geeknik I pushed a new commit c1f04e8e11b232c0fc3baa462e0a579fd3bdad4d which fixes cause of the problems for transformSequences - now any chars can be input, not just those in range 0-127. I also fixed all of the compiler warnings.
I did not use E_coli_DH1
since it is too large for afl-fuzz, I used much simpler test cases from the aligner/ dir instead, to speed up the testing.
Please keep in mind that edlib-aligner
is not the central piece of Edlib, edlib library is. I created edlib-aligner
in order to test edlib and run it easily, but I did not put much effort in ensuring that it is bullet-proof regarding the input - I am happy to try and improve on that, but I may not be going that far to ensure every kind of possible input works.
Solved with c1f04e8
Compiled with afl-clang-fast++ and ASan.
./edlib-aligner -p test003 test003
test003.zip