Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Core/Libraries/Source/WWVegas/WW3D2/htree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ int HTreeClass::Load_W3D(ChunkLoadClass & cload)
*/
bool pre30 = false;
if (header.Version < W3D_MAKE_VERSION(3,0)) {
// TheSuperHackers @fix CryoTheRenegade 24/08/2026 Reject UINT32_MAX pivot counts so the pre-3.0 increment cannot wrap to zero, skip allocation, and then write Pivot[0].
if (header.NumPivots == 0xffffffffu) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this happen in practice?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot happen with a valid W3D from the normal exporter. It requires a corrupt or crafted pre-3.0 file with NumPivots set to 0xffffffff.

This is primarily for custom map/assets which may have been corrupted or maliciously edited that would lead to a client crash.

return LOAD_ERROR;
}
header.NumPivots ++;
pre30 = true;
}
Expand Down Expand Up @@ -267,6 +271,9 @@ bool HTreeClass::read_pivots(ChunkLoadClass & cload,bool pre30)
** this so we just put one in.
*/
if (pre30) {
if (Pivot == nullptr || NumPivots < 1) {
return false;
}
Pivot[0].Index = 0;
Pivot[0].Parent = nullptr;
Pivot[0].BaseTransform.Make_Identity();
Expand Down
Loading