Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop in SpectralData::aGetSpectralRecord #3

Open
guidovranken opened this issue Jul 7, 2020 · 0 comments
Open

Infinite loop in SpectralData::aGetSpectralRecord #3

guidovranken opened this issue Jul 7, 2020 · 0 comments

Comments

@guidovranken
Copy link

do{
//now we parse the data records
if (!lRecord.icflag[0] && !lRecord.icflag[1]){
//flag indicates that record is the start of a data set
rvalue = recordTuple();
rvalue.id = lIndex;
std::memcpy(rvalue.title, lRecord.ititl, 40);
rvalue.channels = lRecord.itchan;
std::memcpy(&(rvalue.reflectances[0]), lRecord.data, 1024);
lContinuationCount = 0;
}
if (lRecord.icflag[0] && !lRecord.icflag[1]){
//flag indicates that record is a continution data set
int lCurrentCopyIndex = 256 + lContinuationCount * 383;
if (lCurrentCopyIndex + 383 <= rvalue.channels){
std::memcpy(&(rvalue.reflectances[lCurrentCopyIndex]), lRecord.cdata, 1532);
}
else{
std::memcpy(&(rvalue.reflectances[lCurrentCopyIndex]), lRecord.cdata, 4 * (rvalue.channels - lCurrentCopyIndex));
}
lContinuationCount++;
}
lRecord = this->mUSGSDataRecord.aGetRecordUSGSFormat(lIndex + lContinuationCount + 1);
} while (lRecord.icflag[0]); //keep processing if the record is a continuation record

Input data can be such that lContinuationCount is never incremented, and the same records keeps getting retrieved at line 71, and the do { } while () loop is never broken out of.

This can occur when processing untrusted input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant