Skip to content

Commit 9e024b6

Browse files
Fixed overflow when accessing stream data at offsets > 4GB
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.
1 parent b59b75f commit 9e024b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PDB_DirectMSFStream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ PDB_NO_DISCARD PDB::DirectMSFStream::IndexAndOffset PDB::DirectMSFStream::GetBlo
111111
PDB_NO_DISCARD size_t PDB::DirectMSFStream::GetDataOffsetForIndexAndOffset(const IndexAndOffset& indexAndOffset) const PDB_NO_EXCEPT
112112
{
113113
// work out the offset within the data based on the block indices
114-
const size_t offsetWithinData = (m_blockIndices[indexAndOffset.index] << m_blockSizeLog2) + indexAndOffset.offsetWithinBlock;
114+
const size_t offsetWithinData = (static_cast<size_t>(m_blockIndices[indexAndOffset.index]) << m_blockSizeLog2) + indexAndOffset.offsetWithinBlock;
115115

116116
return offsetWithinData;
117117
}

0 commit comments

Comments
 (0)