Skip to content

Commit 0102cf0

Browse files
committed
gh-102701: Fix overflow in dictobject.c
1 parent 1c9f339 commit 0102cf0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix overflow when creating very large dict.

Objects/dictobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ new_keys_object(PyInterpreterState *interp, uint8_t log2_size, bool unicode)
596596

597597
assert(log2_size >= PyDict_LOG_MINSIZE);
598598

599-
usable = USABLE_FRACTION(1<<log2_size);
599+
usable = USABLE_FRACTION((size_t)1<<log2_size);
600600
if (log2_size < 8) {
601601
log2_bytes = log2_size;
602602
}

0 commit comments

Comments
 (0)