Skip to content

Commit

Permalink
Fixed overflow when accessing stream data at offsets > 4GB
Browse files Browse the repository at this point in the history
This fixes a long-standing issue with PDB files > 4GB.
When accessing stream data at file offsets > 4GB, the subexpression would overflow, resulting in a wrong offset.
This issue is only noticeable on PDB files > 4GB, and then only when stream data starts at an offset > 4GB.
  • Loading branch information
MolecularMatters committed Sep 7, 2023
1 parent b59b75f commit 9e024b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PDB_DirectMSFStream.cpp
Expand Up @@ -111,7 +111,7 @@ PDB_NO_DISCARD PDB::DirectMSFStream::IndexAndOffset PDB::DirectMSFStream::GetBlo
PDB_NO_DISCARD size_t PDB::DirectMSFStream::GetDataOffsetForIndexAndOffset(const IndexAndOffset& indexAndOffset) const PDB_NO_EXCEPT
{
// work out the offset within the data based on the block indices
const size_t offsetWithinData = (m_blockIndices[indexAndOffset.index] << m_blockSizeLog2) + indexAndOffset.offsetWithinBlock;
const size_t offsetWithinData = (static_cast<size_t>(m_blockIndices[indexAndOffset.index]) << m_blockSizeLog2) + indexAndOffset.offsetWithinBlock;

return offsetWithinData;
}

0 comments on commit 9e024b6

Please sign in to comment.