mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Check for boundary errors in [r]find -- find("x", "", 2) should return -1.
This commit is contained in:
parent
c8d36284f3
commit
031c6315e2
1 changed files with 2 additions and 2 deletions
|
@ -349,7 +349,7 @@ strop_find(self, args)
|
|||
if (i < 0)
|
||||
i = 0;
|
||||
|
||||
if (n == 0)
|
||||
if (n == 0 && i <= last)
|
||||
return PyInt_FromLong((long)i);
|
||||
|
||||
last -= n;
|
||||
|
@ -394,7 +394,7 @@ strop_rfind(self, args)
|
|||
if (i < 0)
|
||||
i = 0;
|
||||
|
||||
if (n == 0)
|
||||
if (n == 0 && i <= last)
|
||||
return PyInt_FromLong((long)last);
|
||||
|
||||
for (j = last-n; j >= i; --j)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue