1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a possible integer overflow in GetAbsTime()

This commit is contained in:
Klaus Schmidinger 2008-09-06 09:41:15 +02:00
parent 248b7424be
commit 2e66fdd634
3 changed files with 12 additions and 8 deletions

View File

@ -1902,6 +1902,7 @@ Alexander Rieger <Alexander.Rieger@inka.de>
for fixing cTimer::operator=() in case a cTimer variable is assigned to itself for fixing cTimer::operator=() in case a cTimer variable is assigned to itself
for making the list of tracks given in cStatus::SetAudioTrack() NULL terminated for making the list of tracks given in cStatus::SetAudioTrack() NULL terminated
for fixing handling kLeft in the calls to cStatus::MsgOsdTextItem() for fixing handling kLeft in the calls to cStatus::MsgOsdTextItem()
for fixing a possible integer overflow in GetAbsTime()
Philip Prindeville <philipp_subx@redfish-solutions.com> Philip Prindeville <philipp_subx@redfish-solutions.com>
for updates to 'sources.conf' for updates to 'sources.conf'

View File

@ -5762,7 +5762,7 @@ Video Disk Recorder Revision History
- Increased the time between checking the CAM status to 500ms to avoid problems - Increased the time between checking the CAM status to 500ms to avoid problems
with some CAMs (reported by Arthur Konovalov). with some CAMs (reported by Arthur Konovalov).
2008-08-16: Version 1.7.1 2008-09-06: Version 1.7.1
- Adapted the tuning code to the new DVBFE_SET_DELSYS API (thanks to Reinhard Nissl). - Adapted the tuning code to the new DVBFE_SET_DELSYS API (thanks to Reinhard Nissl).
VDR now uses the driver from http://jusst.de/hg/multiproto_plus. VDR now uses the driver from http://jusst.de/hg/multiproto_plus.
@ -5805,8 +5805,9 @@ Video Disk Recorder Revision History
and the SVDRP commands NEWC/MODC/LSTC has been extended. The video stream type and the SVDRP commands NEWC/MODC/LSTC has been extended. The video stream type
now follows the VPID and optional PPID, separated by an '=' sign. now follows the VPID and optional PPID, separated by an '=' sign.
- Updated the sources.conf file (thanks to Oleg Roitburd). - Updated the sources.conf file (thanks to Oleg Roitburd).
- Fixed a possible integer overflow in GetAbsTime() (thanks to Alexander Rieger).
2008-08-16: Version 1.6.0-2 2008-09-06: Version 1.6.0-2
- Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Italian OSD texts (thanks to Diego Pierotto).
- The SVDRP signon message now indicates the character encoding in use, as in - The SVDRP signon message now indicates the character encoding in use, as in
@ -5816,3 +5817,4 @@ Video Disk Recorder Revision History
- No longer calling FcFini() to avoid problems with older (broken) versions of - No longer calling FcFini() to avoid problems with older (broken) versions of
fontconfig (suggested by Edgar Toernig). fontconfig (suggested by Edgar Toernig).
- Updated the sources.conf file (thanks to Oleg Roitburd). - Updated the sources.conf file (thanks to Oleg Roitburd).
- Fixed a possible integer overflow in GetAbsTime() (thanks to Alexander Rieger).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: thread.c 2.1 2008/04/13 11:53:56 kls Exp $ * $Id: thread.c 2.2 2008/09/06 09:39:43 kls Exp $
*/ */
#include "thread.h" #include "thread.h"
@ -25,11 +25,12 @@ static bool GetAbsTime(struct timespec *Abstime, int MillisecondsFromNow)
{ {
struct timeval now; struct timeval now;
if (gettimeofday(&now, NULL) == 0) { // get current time if (gettimeofday(&now, NULL) == 0) { // get current time
now.tv_usec += MillisecondsFromNow * 1000; // add the timeout now.tv_sec += MillisecondsFromNow / 1000; // add full seconds
while (now.tv_usec >= 1000000) { // take care of an overflow now.tv_usec += (MillisecondsFromNow % 1000) * 1000; // add microseconds
now.tv_sec++; if (now.tv_usec >= 1000000) { // take care of an overflow
now.tv_usec -= 1000000; now.tv_sec++;
} now.tv_usec -= 1000000;
}
Abstime->tv_sec = now.tv_sec; // seconds Abstime->tv_sec = now.tv_sec; // seconds
Abstime->tv_nsec = now.tv_usec * 1000; // nano seconds Abstime->tv_nsec = now.tv_usec * 1000; // nano seconds
return true; return true;