Skip to content

Commit 8291e41

Browse files
committed
Fix invalid iterator increment
1 parent 1fa4ffe commit 8291e41

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Core/SaveState.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ namespace SaveState
281281
if (blockSize > 0) {
282282
result.insert(result.end(), compressed.begin() + i, compressed.begin() + i + blockSize);
283283
i += blockSize;
284-
basePos += blockSize;
284+
// This check is to avoid advancing basePos out of range, which MSVC catches.
285+
// When this happens, we're at the end of decoding anyway.
286+
if (base.end() - basePos >= blockSize) {
287+
basePos += blockSize;
288+
}
285289
}
286290
}
287291
}

0 commit comments

Comments
 (0)