File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ class RawFileReader
120120 true , // ErrWrongNumberOfTF
121121 true , // ErrHBFJump
122122 false , // ErrNoSuperPageForTF
123- true , // ErrNoSOX
123+ false , // ErrNoSOX
124124 true , // ErrMismatchTF
125125 };
126126 // ================================================================================
@@ -250,6 +250,7 @@ class RawFileReader
250250 void setCheckErrors (uint32_t m = 0xffffffff ) { mCheckErrors = m & ((0x1 << NErrorsDefined) - 1 ); }
251251 int getVerbosity () const { return mVerbosity ; }
252252 uint32_t getCheckErrors () const { return mCheckErrors ; }
253+ bool isProcessingStopped () const { return mStopProcessing ; }
253254
254255 void setNominalSPageSize (int n = 0x1 << 20 ) { mNominalSPageSize = n > (0x1 << 15 ) ? n : (0x1 << 15 ); }
255256 int getNominalSPageSize () const { return mNominalSPageSize ; }
@@ -315,6 +316,7 @@ class RawFileReader
315316 long int mPosInFile = 0 ; // ! current position in the file
316317 bool mMultiLinkFile = false ; // ! was > than 1 link seen in the file?
317318 bool mCacheData = false ; // ! cache data to block after 1st scan (may require excessive memory, use with care)
319+ bool mStopProcessing = false ; // ! stop processing after error
318320 uint32_t mCheckErrors = 0 ; // ! mask for errors to check
319321 FirstTFDetection mFirstTFAutodetect = FirstTFDetection::Disabled; // !
320322 bool mPreferCalculatedTFStart = false ; // ! prefer TFstart calculated via HBFUtils
Original file line number Diff line number Diff line change @@ -590,7 +590,14 @@ bool RawFileReader::preprocessFile(int ifl)
590590 lID = getLinkLocalID (rdh, mCurrentFileID );
591591 }
592592 bool newSPage = lID != lIDPrev;
593- mLinksData [lID].preprocessCRUPage (rdh, newSPage);
593+ try {
594+ mLinksData [lID].preprocessCRUPage (rdh, newSPage);
595+ } catch (...) {
596+ LOG (error) << " Corrupted data, abandoning processing" ;
597+ mStopProcessing = true ;
598+ break ;
599+ }
600+
594601 if (mLinksData [lID].nTimeFrames && (mLinksData [lID].nTimeFrames - 1 > mMaxTFToRead )) { // limit reached, discard the last read
595602 mLinksData [lID].nTimeFrames --;
596603 mLinksData [lID].blocks .pop_back ();
@@ -706,6 +713,10 @@ bool RawFileReader::init()
706713 mEmpty = false ;
707714 }
708715 }
716+ if (mStopProcessing ) {
717+ LOG (error) << " Abandoning processing due to corrupted data" ;
718+ return false ;
719+ }
709720 mOrderedIDs .resize (mLinksData .size ());
710721 for (int i = mLinksData .size (); i--;) {
711722 mOrderedIDs [i] = i;
Original file line number Diff line number Diff line change @@ -206,8 +206,8 @@ void RawReaderSpecs::run(o2f::ProcessingContext& ctx)
206206 auto tfID = mReader ->getNextTFToRead ();
207207 int nlinks = mReader ->getNLinks ();
208208
209- if (tfID > mMaxTFID ) {
210- if (!mReader ->isEmpty () && --mLoop ) {
209+ if (tfID > mMaxTFID || mReader -> isProcessingStopped () ) {
210+ if (!mReader ->isProcessingStopped () && ! mReader -> isEmpty () && --mLoop ) {
211211 mLoopsDone ++;
212212 tfID = 0 ;
213213 LOG (info) << " Starting new loop " << mLoopsDone << " from the beginning of data" ;
You can’t perform that action at this time.
0 commit comments