seshnadathur / Revolver

Real-space void locations from survey reconstruction
GNU General Public License v3.0
8 stars 12 forks source link

fix bug (issues/9) of accessing the array orig at invalid indices #10

Closed broukema closed 4 years ago

broukema commented 5 years ago

In src/voz1b1.c the array orig can be accessed at an invalid index, yielding what to the user appears to be a programming error but in reality is an unwise choice of analysis parameters. This bug is listed as https://github.com/seshnadathur/Revolver/issues/9 .

This commit solves the bug by initialising a boolean array orig_exists to have all members false. This array is updated along with the two lines that evaluate orig. When orig is used later on, orig_exists is first checked to see if this is valid. If it's invalid, the user is warned and a fatal error occurs.