From 78703f3651c110388cddd4e7d0ff43e1d174602c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 20 Mar 2022 16:43:18 +0100 Subject: [PATCH] Fixed broken subdivs parsing --- src/map/IMG/trefile.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/map/IMG/trefile.cpp b/src/map/IMG/trefile.cpp index d66dd1af..8659e8b7 100644 --- a/src/map/IMG/trefile.cpp +++ b/src/map/IMG/trefile.cpp @@ -235,6 +235,9 @@ bool TREFile::load(int idx) totalSubdivs += _levels.at(i).subdivs; quint32 extendedSubdivs = _extended.size / _extended.itemSize; quint32 diff = totalSubdivs - extendedSubdivs + 1; + if (skip < diff) + return true; + if (!seek(hdl, _extended.offset + (skip - diff) * _extended.itemSize)) goto error;