mirror of
https://github.com/python/cpython.git
synced 2026-01-30 22:55:41 +00:00
Check for boundary errors in [r]find -- find("x", "", 2) should return -1.
This commit is contained in:
parent
c8d36284f3
commit
031c6315e2
@ -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…
x
Reference in New Issue
Block a user