From 0fb35401d4de13926172e18de8dd1014e66b583d Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sat, 8 Feb 2020 12:07:41 +0100 Subject: [PATCH] Avoid going out of bounds in IsSubsequenceOf Closes #35598 (cherry picked from commit 4b79ef5ebe2faa4b3690d90dc36ab6ead5ff1315) --- .../mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs index ffef50cc185..b85a00d869c 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs @@ -475,7 +475,7 @@ namespace Godot int source = 0; int target = 0; - while (instance[source] != 0 && text[target] != 0) + while (source < len && target < text.Length) { bool match; @@ -492,7 +492,7 @@ namespace Godot if (match) { source++; - if (instance[source] == 0) + if (source >= len) return true; }