Avoid going out of bounds in IsSubsequenceOf

Closes #35598
This commit is contained in:
Raul Santos 2020-02-08 12:07:41 +01:00
parent 343b29a651
commit 4b79ef5ebe
No known key found for this signature in database
GPG key ID: B532473AE3A803E4

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