Merge pull request #36013 from raulsntos/fix-issubsequenceof

Avoid going out of bounds in IsSubsequenceOf
This commit is contained in:
Rémi Verschelde 2020-02-09 00:02:30 +01:00 committed by GitHub
commit 9cc4f5e3ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
} }