Skip to content

Commit 1a13f3a

Browse files
committed
bug
1 parent dad1c9e commit 1a13f3a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Objects/stringlib/fastsearch.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,14 @@ STRINGLIB(_lex_search)(const STRINGLIB_CHAR *needle,
245245
*/
246246
int dir = reversed ? -1 : 1;
247247
// starting position from chosen direction
248-
Py_ssize_t stt = reversed ? m - 1 : 0;
249-
Py_ssize_t m = needle_len;
248+
Py_ssize_t stt = reversed ? needle_len - 1 : 0;
250249
Py_ssize_t max_suffix = 0;
251250
Py_ssize_t candidate = 1;
252251
Py_ssize_t k = 0;
253252
// The period of the right half.
254253
Py_ssize_t period = 1;
255254
STRINGLIB_CHAR a, b;
256-
while (candidate + k < m) {
255+
while (candidate + k < needle_len) {
257256
// each loop increases (in chosen direction) candidate + k + max_suffix
258257
a = needle[stt + dir*(candidate + k)];
259258
b = needle[stt + dir*(max_suffix + k)];

0 commit comments

Comments
 (0)