}
fCount |= ((temp & 0x3FF) >> 6);
if (fCount == 0) return kFALSE;
-
+ if (fCount >= fPosition) {
+ fRawReader->AddMajorErrorLog(kAltroTrailerErr,"invalid size");
+ // PrintDebug();
+ AliWarning(Form("Incorrect trailer found ! The altro payload size is invalid (%d >= %d) !",fCount,fPosition));
+ fCount = 0;
+ return kFALSE;
+ }
temp = GetNextWord();
fHWAddress |= temp;
{
// Read altro payload in
// backward direction
- if (fPosition <= 0) {
+ if (fCount <= 2) {
fRawReader->AddMinorErrorLog(kBunchLengthReadErr,"");
// PrintDebug();
- AliWarning("Could not read bunch length !");
+ AliWarning(Form("Could not read bunch length and time bin ! Only %d 10-bit words are left !",fCount));
+ fBunchLength = fTimeBunch = fCount = 0;
+ return;
}
fBunchLength = GetNextWord() - 2;
- fTimeBunch = fBunchLength;
- fCount--;
-
- if (fPosition <= 0) {
- fRawReader->AddMinorErrorLog(kTimeBinReadErr,"");
+ if (fBunchLength > fCount) {
+ fRawReader->AddMinorErrorLog(kBunchLengthReadErr,Form("bl=%d",fBunchLength));
// PrintDebug();
- AliWarning("Could not read time bin !");
+ AliWarning(Form("Could not read bunch length ! Bunch length = %d (>%d)",fBunchLength,fCount));
+ fBunchLength = fTimeBunch = fCount = 0;
+ return;
}
+ fTimeBunch = fBunchLength;
+ fCount--;
fTime = GetNextWord();
fCount--;
void AliAltroRawStream::ReadAmplitude()
{
// Read next time bin amplitude
- if (fPosition <= 0) {
+ if (fCount <= 0) {
fRawReader->AddMinorErrorLog(kAmplitudeReadErr,"");
// PrintDebug();
AliWarning("Could not read sample amplitude !");
+ fCount = fSignal = fBunchLength = 0;
+ return;
}
fSignal = GetNextWord();
+
fCount--;
fBunchLength--;
// Now read the beginning of the trailer
// where the payload size is written
if (trailerSize < 2) {
- PrintDebug();
- AliFatal(Form("Invalid trailer size found (%d bytes) !",trailerSize*4));
+ fRawReader->AddMajorErrorLog(kRCUTrailerErr,Form("tr=%d bytes",
+ trailerSize*4));
+ AliWarning(Form("Invalid trailer size found (%d bytes) !",
+ trailerSize*4));
}
fRCUTrailerSize = (trailerSize-2)*4;
index -= fRCUTrailerSize;
if (index < 4) {
- PrintDebug();
- AliFatal(Form("Invalid trailer size found (%d bytes) ! The size is bigger than the raw data size (%d bytes)!",
- trailerSize*4,
- fRawReader->GetDataSize()));
+ fRawReader->AddMajorErrorLog(kRCUTrailerErr,Form("tr=%d raw=%d bytes",
+ trailerSize*4,
+ fRawReader->GetDataSize()));
+ AliWarning(Form("Invalid trailer size found (%d bytes) ! The size is bigger than the raw data size (%d bytes)!",
+ trailerSize*4,
+ fRawReader->GetDataSize()));
}
fRCUTrailerData = fData + index;
Int_t position = Get32bitWord(index);
position *= 5;
// Check the consistency of the header and trailer
- if ((fRawReader->GetDataSize() - trailerSize*4) != position) {
- PrintDebug();
- AliFatal(Form("Inconsistent raw data size ! Raw data size - %d bytes (from the header), RCU trailer - %d bytes, raw data paylod - %d bytes !",
+ if (((fRawReader->GetDataSize() - trailerSize*4) < position) ||
+ ((fRawReader->GetDataSize() - trailerSize*4) >= (position + 4))) {
+ fRawReader->AddMajorErrorLog(kRCUTrailerSizeErr,Form("h=%d tr=%d rcu=%d bytes",
+ fRawReader->GetDataSize(),
+ trailerSize*4,
+ position));
+ AliWarning(Form("Inconsistent raw data size ! Raw data size - %d bytes (from the header), RCU trailer - %d bytes, raw data paylod - %d bytes !",
fRawReader->GetDataSize(),
trailerSize*4,
position));
+ position = fRawReader->GetDataSize() - trailerSize*4;
}
return position * 8 / 10;
if (!fIsShortDataHeader) {
// Check the consistency of the header and trailer
- if ((fRawReader->GetDataSize() - 4) != position) {
+ if (((fRawReader->GetDataSize() - 4) < position) ||
+ ((fRawReader->GetDataSize() - 4) >= (position + 4))) {
fRawReader->AddMajorErrorLog(kRCUTrailerSizeErr,Form("h=%d rcu=%d bytes",
fRawReader->GetDataSize()-4,
position));
else {
// Check the consistency of the header and trailer
// In this case the header is shorter by 4 bytes
- if (fRawReader->GetDataSize() != position) {
+ if ((fRawReader->GetDataSize() < position) ||
+ (fRawReader->GetDataSize() >= (position + 4))) {
fRawReader->AddMajorErrorLog(kRCUTrailerSizeErr,Form("h=%d rcu=%d bytes",
fRawReader->GetDataSize(),
position));