mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
fix(wob): clamp out-of-range group indices + reject absurd texture path lengths
Mirrors the WOM index-clamp + texture-path-length guards. Out-of-range indices into the WMO group's vertex buffer would crash the GPU draw. Texture path length over 1KB indicates a corrupted/truncated WoB; clamp to 0 to prevent allocating 65KB-string buffers per bad entry.
This commit is contained in:
parent
a2eaf3965a
commit
53780de6da
1 changed files with 7 additions and 0 deletions
|
|
@ -72,10 +72,17 @@ WoweeBuilding WoweeBuildingLoader::load(const std::string& basePath) {
|
|||
}
|
||||
grp.indices.resize(ic);
|
||||
f.read(reinterpret_cast<char*>(grp.indices.data()), ic * 4);
|
||||
// Same out-of-range index clamp as the WOM loader — bad indices
|
||||
// would crash the GPU draw on the WMO group.
|
||||
const uint32_t vMax = vc > 0 ? vc - 1 : 0;
|
||||
for (auto& idx : grp.indices) {
|
||||
if (idx > vMax) idx = 0;
|
||||
}
|
||||
|
||||
for (uint32_t ti = 0; ti < tc; ti++) {
|
||||
uint16_t tl;
|
||||
f.read(reinterpret_cast<char*>(&tl), 2);
|
||||
if (tl > 1024) tl = 0;
|
||||
std::string tp(tl, '\0');
|
||||
f.read(tp.data(), tl);
|
||||
grp.texturePaths.push_back(tp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue