Fix std.string handling out of range indices in search methods
This commit is contained in:
parent
9c95d09f60
commit
8b3fa6f2fe
1 changed files with 3 additions and 0 deletions
|
@ -82,6 +82,9 @@ var string = {
|
|||
},
|
||||
_find: func(first, last, s, eq)
|
||||
{
|
||||
if( first < 0 or last < 0 )
|
||||
return -1;
|
||||
|
||||
var sign = first <= last ? 1 : -1;
|
||||
for(var i = first; sign * i < last; i += sign)
|
||||
if( me._eq(i, s) == eq )
|
||||
|
|
Loading…
Reference in a new issue