Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Python/parking_lot.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ _PySemaphore_PlatformWait(_PySemaphore *sema, PyTime_t timeout)
millis = INFINITE;
}
else {
millis = (DWORD) (timeout / 1000000);
// Prevent overflow with clamping the result
if ((PyTime_t)PY_DWORD_MAX * 1000000 < timeout) {
millis = PY_DWORD_MAX;
}
else {
millis = (DWORD) (timeout / 1000000);
}
}
wait = WaitForSingleObjectEx(sema->platform_sem, millis, FALSE);
if (wait == WAIT_OBJECT_0) {
Expand Down
Loading