core: Add validation to timeval parameters
authorChris Dickens <christopher.a.dickens@gmail.com>
Thu, 27 Aug 2020 18:05:11 +0000 (11:05 -0700)
committerChris Dickens <christopher.a.dickens@gmail.com>
Sun, 13 Sep 2020 07:09:19 +0000 (00:09 -0700)
commit63934ff179dd1bfa8e91f35844c802fff8038ab6
tree1d3d0b446f9dc3d83ca47d3c92e0f1ebec51c52c
parentcca8852dc9e463d86f9d4cf5a85269173c808fc9
core: Add validation to timeval parameters

Prior to this change, the timeval structures provided by users did not
go through any type of validation, therefore an invalid timeval would
result in potentially unclear or confusing errors when used later on.
Add checks to the core API functions that accept timevals and return
LIBUSB_ERROR_INVALID_PARAM if the timeval is not valid.

While at it, add some macro definitions to avoid magic numbers.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/io.c
libusb/libusbi.h
libusb/os/threads_posix.c
libusb/version_nano.h