diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2012-09-20 18:56:47 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-09-20 18:56:47 (GMT) |
| commit | ca8aa4acf6755dd012706e1e38fb737ae83ab5c6 (patch) | |
| tree | 310b20a536a99dd80657e2d22e07bb1466d0a895 /Objects/stringlib/fastsearch.h | |
| parent | 1c47222a256f2977dcbb36c05dce7a5ae8e6ae06 (diff) | |
| download | cpython-ca8aa4acf6755dd012706e1e38fb737ae83ab5c6.zip cpython-ca8aa4acf6755dd012706e1e38fb737ae83ab5c6.tar.gz cpython-ca8aa4acf6755dd012706e1e38fb737ae83ab5c6.tar.bz2 | |
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.
Diffstat (limited to 'Objects/stringlib/fastsearch.h')
| -rw-r--r-- | Objects/stringlib/fastsearch.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/stringlib/fastsearch.h b/Objects/stringlib/fastsearch.h index 5b8d5db..ecf885e 100644 --- a/Objects/stringlib/fastsearch.h +++ b/Objects/stringlib/fastsearch.h @@ -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) { |
