Menu

#68 RinSum --gaps <dt> ends wih segmentation fault

Untested
open
nobody
None
5
2014-04-17
2014-04-17
No

RinSum fails with segmentation fault when run with --gaps <dt> option on a RINEX file with either no gaps or continuous periods of observations and when dt is set to INTERVAL value from the RINEX file.

There is a bug in RinSum.cpp file at lines 1016-1017, 1030-1032, 1059-1060, and 1069-1071, e.g:

for(i=1; i<=k-2; i+=2) oss << " (" << C.gapcount[i]+1    // begin of gap
   << "," << C.gapcount[i+1]-C.gapcount[i]-1 << ")";     // size

where

k = C.gapcount.size()-1;               // size() is at least 2

is 1 in case no gap was found and thus elements out of C.gapcount vector bounds are accessed, which causes segmentation fault.

This could be fix by adding condition

if (k > 2)
   for(i=1; i<=k-2; i+=2) oss << " (" << C.gapcount[i]+1    // begin of gap
      << "," << C.gapcount[i+1]-C.gapcount[i]-1 << ")";     // size

Please find attached a patch for this issue.

Tested with precompiled as well as built RinSum Ver 2.2 10/31/13 from GPStk v2.3 on Linux (Kubuntu 13.10).

1 Attachments

Discussion