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 /Include/objimpl.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 'Include/objimpl.h')
-rw-r--r-- | Include/objimpl.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h index b1a624c..3d5f509 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -181,12 +181,9 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); #endif #define _PyObject_VAR_SIZE(typeobj, nitems) \ - (size_t) \ - ( ( (typeobj)->tp_basicsize + \ - (nitems)*(typeobj)->tp_itemsize + \ - (SIZEOF_VOID_P - 1) \ - ) & ~(SIZEOF_VOID_P - 1) \ - ) + _Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + \ + (nitems)*(typeobj)->tp_itemsize, \ + SIZEOF_VOID_P) #define PyObject_NEW(type, typeobj) \ ( (type *) PyObject_Init( \ |