Browse Source

Avoid going out of bounds in IsSubsequenceOf
Closes #35598

Raul Santos 5 years ago
parent
commit
4b79ef5ebe

+ 2 - 2
modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs

@@ -474,7 +474,7 @@ namespace Godot
             int source = 0;
             int source = 0;
             int target = 0;
             int target = 0;
 
 
-            while (instance[source] != 0 && text[target] != 0)
+            while (source < len && target < text.Length)
             {
             {
                 bool match;
                 bool match;
 
 
@@ -491,7 +491,7 @@ namespace Godot
                 if (match)
                 if (match)
                 {
                 {
                     source++;
                     source++;
-                    if (instance[source] == 0)
+                    if (source >= len)
                         return true;
                         return true;
                 }
                 }