From fd5d7cfd7b0ac0cd0abf723ffe589931c5915cbb Mon Sep 17 00:00:00 2001 From: Rainer Clasen Date: Tue, 8 Jul 2014 06:51:08 +0200 Subject: [PATCH] SrmRideFile: handle EOF while reading chunks code was blindly trusting datacnt... and kept reading past EOF. That's bad as datacnt occasionally isn't matching the available data (overflow, corruption, ...) --- src/SrmRideFile.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/SrmRideFile.cpp b/src/SrmRideFile.cpp index 9b498788e..8ff5d074f 100644 --- a/src/SrmRideFile.cpp +++ b/src/SrmRideFile.cpp @@ -285,6 +285,11 @@ RideFile *SrmFileReader::openRideFile(QFile &file, QStringList &errorStrings, QL return NULL; } + if( in.status() != QDataStream::Ok ){ + errorStrings << QString("premature end of file" ); + break; + } + if (i == 0) { result->setStartTime(blockhdrs[blknum].dt); }