Skip to content

Segmentation fault not catched #2

@FabrizioSandri

Description

@FabrizioSandri

I was trying to run RcppDeepState on the test package provided in the /inst/testSAN on a different machine.

First of all I ran the test harness compilation procedure deepstate_harness_compile_run and it succesfully generated the compiled test harness. After that I ran the deepstate_harness_analyze_pkg function and no matter how many times I ran the function, no bug was reported for the testSAN package.

After some investigation, I discovered that no output file was generated for each Test Harness. For example: the output folder for rcpp_use_after_deallocate function located at testSAN/inst/testfiles/rcpp_use_after_deallocate/rcpp_use_after_deallocate_output was empty. So I attempted to run the Test Harness execution manually. What I discovered is that before the output file is generated, the Test Harness gives me a segmentation failure error.

./rcpp_use_after_deallocate_DeepState_TestHarness --seed=5 --timeout=2 --fuzz --fuzz_save_passing --output_test_dir rcpp_use_after_deallocate_output 

[1]    167004 segmentation fault (core dumped)  ./rcpp_use_after_deallocate_DeepState_TestHarness --seed=5 --timeout=2 --fuzz -fuzz_save_passing --output_test_dir rcpp_use_after_deallocate_output 

Is there something I'm overlooking? The program appears to crash in the try-catch block, without actually catching the error.

TEST(,){
  RInside R;
  std::cout << "input starts" << std::endl;
  IntegerVector array_size(1);
  array_size[0]  = RcppDeepState_int();
  qs::c_qsave(array_size,"/home/fabri/test/testHarness/RcppDeepState/inst/testpkgs/testSAN/inst/testfiles/rcpp_use_after_deallocate/inputs/array_size.qs",
		"high", "zstd", 1, 15, true, 1);
  std::cout << "array_size values: "<< array_size << std::endl;
  std::cout << "input ends" << std::endl;
  try{
    rcpp_use_after_deallocate(array_size[0]);
  }
  catch(Rcpp::exception& e){
    std::cout<<"Exception Handled"<<std::endl;
  }
}

Executing the test on a different machine works perfectly: it catches the errors and saves the test case in the output directory.
@Anirban166 have you ever dealt a situation like this with DeepState?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions