Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a043f3

Browse files
committed
PyUnicode_Contains(): The memcmp() call didn't take into account the
width of Py_UNICODE. Good catch, MAL.
1 parent 496e658 commit 6a043f3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Objects/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3765,7 +3765,7 @@ int PyUnicode_Contains(PyObject *container,
37653765
else {
37663766
end = lhs + (PyUnicode_GET_SIZE(u) - size);
37673767
while (lhs <= end) {
3768-
if (memcmp(lhs++, rhs, size) == 0) {
3768+
if (memcmp(lhs++, rhs, size * sizeof(Py_UNICODE)) == 0) {
37693769
result = 1;
37703770
break;
37713771
}

0 commit comments

Comments
 (0)