Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update readme example? #69

Open
tdhock opened this issue May 21, 2021 · 2 comments
Open

update readme example? #69

tdhock opened this issue May 21, 2021 · 2 comments

Comments

@tdhock
Copy link

tdhock commented May 21, 2021

I ran the example on the README and I got the following, which is different from what you show on the README.

> pkg <- "RcppDeepState/inst/testpkgs/testSAN"
> fun_path <- file.path(pkg, "inst/testfiles/rcpp_write_index_outofbound")
> seed_analyze<-deepstate_fuzz_fun_analyze(fun_path ,1603403708, 5)
Error in deepstate_fuzz_fun_analyze(fun_path, 1603403708, 5) : 
  could not find function "deepstate_fuzz_fun_analyze"
> seed_analyze <- RcppDeepState::deepstate_fuzz_fun_analyze(fun_path ,1603403708, 5)
running the executable .. 
cd /home/tdhock/R/RcppDeepState/inst/testpkgs/testSAN/inst/testfiles/rcpp_write_index_outofbound && valgrind --xml=yes --xml-file=/home/tdhock/R/RcppDeepState/inst/testpkgs/testSAN/inst/testfiles/rcpp_write_index_outofbound/5_1603403708/1603403708_log --tool=memcheck --leak-check=yes --track-origins=yes ./rcpp_write_index_outofbound_DeepState_TestHarness --seed=1603403708 --timeout=5 --fuzz > /home/tdhock/R/RcppDeepState/inst/testpkgs/testSAN/inst/testfiles/rcpp_write_index_outofbound/5_1603403708/seed_valgrind_log_text 2>&1

> seed_analyze
      inputs          logtable
1: <list[1]> <data.table[1x5]>
> seed_analyze$logtable[[1]]
              err.kind
1: Leak_DefinitelyLost
                                                                 message
1: 400 bytes in 1 blocks are definitely lost in loss record 125 of 1,334
                        file.line      address.msg          address.trace
1: write_index_outofbound.cpp : 7 No Address found No Address Trace found
@tdhock
Copy link
Author

tdhock commented May 21, 2021

(base) tdhock@maude-MacBookPro:~/R/RcppDeepState$ valgrind --version
valgrind-3.13.0

@akhikolla
Copy link
Owner

It is the issue with the seed value we provided. DeepState makes use of srand (standard C random number generator library) that's not guaranteed to be consistent across platforms.

The inputs generated by the seed 1603403708 are different in my laptop which caused an InvalidWrite(write_index_outofbound.cpp : 8) error whereas the inputs generated by 1603403708 are different in your platform which produced an Leak_DefinitelyLost(write_index_outofbound.cpp : 7).

The only way we can rectify this is by implementing our own pseudo-random number generators that are cross-platform consistent. There is an issue raised with the deepstate for this trailofbits/deepstate#364.

Maybe I'll provide a note saying that the seed value is different across the platforms and the output may vary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants