[vlc-commits] Improve range check.

Tobias Güntner git at videolan.org
Sat Mar 31 12:59:26 CEST 2012


vlc | branch: master | Tobias Güntner <fatbull at web.de> | Thu Mar 29 23:09:05 2012 +0200| [c34b980c06855220903643f3a33cd9465560f570] | committer: Rémi Denis-Courmont

Improve range check.

Use >= instead of > in range check because INT64_MAX could
be rounded up when converted to a double for comparison.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c34b980c06855220903643f3a33cd9465560f570
---

 modules/demux/live555.cpp |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index 645b176..93433a7 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -1357,8 +1357,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             if( p_sys->f_npt_length > 0 )
             {
                 double d_length = p_sys->f_npt_length * 1000000.0;
-                /* Not sure if -0.5 is needed, but better be safe */
-                if( d_length - 0.5 > INT64_MAX )
+                if( d_length >= INT64_MAX )
                     *pi64 = INT64_MAX;
                 else
                     *pi64 = (int64_t)d_length;



More information about the vlc-commits mailing list