Issue #876: Fix integer overflow on slice_count#877
Issue #876: Fix integer overflow on slice_count#877vstinner wants to merge 1 commit intomicrosoft:dev-slicefrom
Conversation
If the slice count doesn't fit into uint32_t, consider that the
memory allocation failed.
On Linux s390x, allocating around 8,589,934,592 GiB with mmap() works
thanks to overcommit on a machine with 8 GiB of memory:
mmap(NULL,
0x8000000000400000,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE,
-1, 0)
|
Hum, it doesn't seem to be related to my change: |
|
Thanks so much for spotting this! I fixed it differently by defining a |
Do you have a link to the fix? 5050b63 only defines MI_MAX_ALLOC_SIZE as PTRDIFF_MAX. Is it the same fix? |
|
Ah, for |
Sorry, but it's quite complicated to set up the test :-/ Thanks for the fix anyway! |
If the slice count doesn't fit into uint32_t, consider that the memory allocation failed.
On Linux s390x, allocating around 8,589,934,592 GiB with mmap() works thanks to overcommit on a machine with 8 GiB of memory: