diff options
author | wm4 <wm4@nowhere> | 2014-02-26 20:44:27 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-26 21:03:35 +0100 |
commit | 9ccbc03ab17d3aa54cf91945ba1cdb77b60a2167 (patch) | |
tree | 266b94a00e6ca230b328e2a1a6d7ef8b569121c8 /stream/pvr.h | |
parent | 412bb336ab740ef42c36d1bd4a786f1382d2ccd3 (diff) | |
download | mpv-9ccbc03ab17d3aa54cf91945ba1cdb77b60a2167.tar.bz2 mpv-9ccbc03ab17d3aa54cf91945ba1cdb77b60a2167.tar.xz |
threads: fix wait time overflow check
When passing a very large timeout to mpthread_cond_timed_wait(), the
calculations could overflow, setting tv_sec to a negative value, and
making the pthread_cond_timed_wait() call return immediately. This
accidentally made Lua support poll and burn CPU for no reason.
The existing overflow check was ineffective on 32 bit systems. tv_sec is
usually a long, so adding INT_MAX to it will usually not overflow on 64
bit systems, but on 32 bit systems it's guaranteed to overflow. Simply
fix by clamping against a relatively high value. This will work until 1
week before the UNIX time wraps around in 32 bits.
Diffstat (limited to 'stream/pvr.h')
0 files changed, 0 insertions, 0 deletions