overlaytopleft/games-fps/gzdoom/files/0043-Fix-possible-memory-corruption-in-TArray-Delete-inde.patch

27 lines
739 B
Diff
Raw Normal View History

From f658338e869b47321af57838518b7346d8d495df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= <ricolvs123@gmail.com>
Date: Wed, 22 Mar 2023 04:54:29 -0300
Subject: [PATCH 43/51] Fix possible memory corruption in
`TArray::Delete(index, count)`
---
src/common/utility/tarray.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/common/utility/tarray.h b/src/common/utility/tarray.h
index 8d7037db2..cc13050b5 100644
--- a/src/common/utility/tarray.h
+++ b/src/common/utility/tarray.h
@@ -453,6 +453,8 @@ public:
void Delete (unsigned int index, int deletecount)
{
+ if(index >= Count) return;
+
if (index + deletecount > Count)
{
deletecount = Count - index;
--
2.39.3