mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #15144: Fix possible integer overflow when handling pointers as integer values, by using Py_uintptr_t instead of size_t.
Patch by Serhiy Storchaka.
This commit is contained in:
parent
1c47222a25
commit
ca8aa4acf6
11 changed files with 44 additions and 45 deletions
|
|
@ -43,8 +43,7 @@ STRINGLIB(fastsearch_memchr_1char)(const STRINGLIB_CHAR* s, Py_ssize_t n,
|
|||
|
||||
#define DO_MEMCHR(memchr, s, needle, nchars) do { \
|
||||
candidate = memchr((const void *) (s), (needle), (nchars) * sizeof(STRINGLIB_CHAR)); \
|
||||
found = (const STRINGLIB_CHAR *) \
|
||||
((Py_ssize_t) candidate & (~ ((Py_ssize_t) sizeof(STRINGLIB_CHAR) - 1))); \
|
||||
found = (const STRINGLIB_CHAR *) _Py_ALIGN_DOWN(candidate, sizeof(STRINGLIB_CHAR)); \
|
||||
} while (0)
|
||||
|
||||
if (mode == FAST_SEARCH) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue