Commit bdc4b029 authored by Benjamin Peterson's avatar Benjamin Peterson

cast negative numbers to size_t before shifting them (#20929)

parent 21b391c9
...@@ -265,7 +265,7 @@ extern PyGC_Head *_PyGC_generation0; ...@@ -265,7 +265,7 @@ extern PyGC_Head *_PyGC_generation0;
#define _PyGCHead_REFS(g) ((g)->gc.gc_refs >> _PyGC_REFS_SHIFT) #define _PyGCHead_REFS(g) ((g)->gc.gc_refs >> _PyGC_REFS_SHIFT)
#define _PyGCHead_SET_REFS(g, v) do { \ #define _PyGCHead_SET_REFS(g, v) do { \
(g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK) \ (g)->gc.gc_refs = ((g)->gc.gc_refs & ~_PyGC_REFS_MASK) \
| (v << _PyGC_REFS_SHIFT); \ | (((size_t)(v)) << _PyGC_REFS_SHIFT); \
} while (0) } while (0)
#define _PyGCHead_DECREF(g) ((g)->gc.gc_refs -= 1 << _PyGC_REFS_SHIFT) #define _PyGCHead_DECREF(g) ((g)->gc.gc_refs -= 1 << _PyGC_REFS_SHIFT)
......
...@@ -8,6 +8,8 @@ What's New in Python 3.4.1? ...@@ -8,6 +8,8 @@ What's New in Python 3.4.1?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #20929: Add a type cast to avoid shifting a negative number.
- Issue #20731: Properly position in source code files even if they - Issue #20731: Properly position in source code files even if they
are opened in text mode. Patch by Serhiy Storchaka. are opened in text mode. Patch by Serhiy Storchaka.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment