Skip to content

Commit

Permalink
pythongh-102701: Fix overflow in dictobject.c
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Mar 16, 2023
1 parent 1c9f339 commit 0102cf0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix overflow when creating very large dict.
2 changes: 1 addition & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ new_keys_object(PyInterpreterState *interp, uint8_t log2_size, bool unicode)

assert(log2_size >= PyDict_LOG_MINSIZE);

usable = USABLE_FRACTION(1<<log2_size);
usable = USABLE_FRACTION((size_t)1<<log2_size);
if (log2_size < 8) {
log2_bytes = log2_size;
}
Expand Down

0 comments on commit 0102cf0

Please sign in to comment.