Skip to content

Commit

Permalink
Validate timeout range.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljmccarthy committed Aug 23, 2014
1 parent 6f43a1d commit 374d765
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fsmonitor/win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ def disable_watch(self, watch):
watch.enabled = False

def read_events(self, timeout=None):
timeout_ms = timeout * 1000 if timeout is not None else 0xFFFFFFFF
timeout_ms = 0xFFFFFFFF
if timeout is not None:
timeout_ms = int(timeout * 1000)
if timeout_ms < 0 or timeout_ms >= 0xFFFFFFFF:
raise ValueError("Timeout value out of range")
try:
events = []
rc, num, key, _ = win32file.GetQueuedCompletionStatus(self.__cphandle, timeout_ms)
Expand Down

0 comments on commit 374d765

Please sign in to comment.