Fix Bounds checking SEGV

RideFileCache hogs CPU / hangs with poorly parsed files, whilst
the activity may crash when columns are removed.
This commit is contained in:
Mark Liversedge
2012-04-05 17:18:43 +01:00
parent 8c027add73
commit 5019abfc69
2 changed files with 8 additions and 0 deletions

View File

@@ -579,6 +579,10 @@ MeanMaxComputer::run()
// fill in any gaps in recording - use same dodgy rounding as before
int count = (psecs - lastsecs - ride->recIntSecs()) / ride->recIntSecs();
// gap more than an hour, damn that ride file is a mess
if (count > 3600) count = 1;
for(int i=0; i<count; i++)
data.points.append(cpintpoint(round(lastsecs+((i+1)*ride->recIntSecs() *1000.0)/1000), 0));
lastsecs = psecs;
@@ -597,6 +601,9 @@ MeanMaxComputer::run()
// than 2 days, even if you are doing RAAM
if (total_secs > 2*24*60*60) return;
// don't allow if badly parsed or time goes backwards
if (total_secs < 0) return;
//
// Pre-process the data for NP, xPower and VAM
//