Skip to content

Commit

Permalink
Detect when too many streams are found in a file
Browse files Browse the repository at this point in the history
Summary:
With the lionhead fuzzer, we're detecting potential problem with bad files.
This change is really made to make lionhead happy.

Reviewed By: finik

Differential Revision: D66267532

fbshipit-source-id: 741e44ebeda991006babec122ff55d8735ac0388
  • Loading branch information
Georges Berenger authored and facebook-github-bot committed Nov 21, 2024
1 parent c3be764 commit 12bf698
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vrs/RecordFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ int RecordFileReader::doOpenFile(
// count the records of each stream & type
streamRecordCounts_.clear();
for (const auto& record : recordIndex_) {
if (streamRecordCounts_.size() > 5000) {
XR_LOGE("Too many different stream IDs found in this file. Let's stop the carnage.");
return INDEX_RECORD_ERROR;
}
streamRecordCounts_[record.streamId][record.recordType]++;
}
}
Expand Down

0 comments on commit 12bf698

Please sign in to comment.