osqzss / gps-sdr-sim

Software-Defined GPS Signal Simulator
MIT License
2.61k stars 760 forks source link

Fixing crash for very large USER_MOTION_SIZE values #389

Closed niklasknoell closed 6 months ago

niklasknoell commented 6 months ago

As mentioned in #317 and #303 a segmentation fault occurs when compiling with large USER_MOTION_SIZE values, preventing the generation of very long simulations. The error is caused by allocating the array containing the xyz motion in the main function, and thus on the stack. With large motion sizes this leads to a stack overflow causing the crash. The very simple fix is to just declare the xyz variable as a global variable outside the main function putting it into the data section of memory.

osqzss commented 6 months ago

Thank you for fixing the segmentation fault issue.