pelahi / VELOCIraptor-STF

Galaxy/(sub)Halo finder for N-body simulations
MIT License
19 stars 26 forks source link

Ramses segmentation fault #102

Closed dpnemergut closed 3 years ago

dpnemergut commented 3 years ago

Describe the bug stf is crashing with a seg fault when running with the sample_galaxycatalog_run configuration with Particle_search_type=1. The seg fault is being thrown in ramsesio.cxx line 43 because the read buffer is the incorrect size (is dummy, should be sizeof(dummy)).

To Reproduce Steps to reproduce the behavior:

  1. Set Particle_search_type=1 in sample_galaxycatalog_run.cfg
  2. Run stf
  3. Observe seg fault while loading input data

Expected behavior Input data should load without seg faulting.

Log files Valgrind stacktrace:

==22366== Invalid write of size 8
==22366==    at 0x4C326CB: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22366==    by 0x5FFBBDF: std::basic_filebuf<char, std::char_traits<char> >::xsgetn(char*, long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==22366==    by 0x60088EA: std::istream::read(char*, long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==22366==    by 0x583BD9: RAMSES_fortran_read(std::basic_fstream<char, std::char_traits<char> >&, int*) (ramsesio.cxx:43)

Additional context I'm about to submit a PR for the fix.

dpnemergut commented 3 years ago

Closing this with the merge of PR #103.