[vlc-devel] [PATCH] demux/asf: fix 17601: fix undesired integer underflow
Filip Roséen
filip at atch.se
Fri Nov 4 10:02:04 CET 2016
This commit shall be viewed as a fix-up of 86835f9.
The previous commit in question did not take into account that the
left-hand side expression can of course result in a negative value,
meaning that the value-promotion necessary for the comparison to take
place would result in a very large value (where we expect a very small
one).
fixes #17601
---
modules/demux/asf/asf.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index 5cbb800..e89ccc8 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -212,8 +212,9 @@ static int Demux( demux_t *p_demux )
tk->b_selected = false;
}
- while( !p_sys->b_eos && ( ( p_sys->i_sendtime - p_sys->i_time - CHUNK ) /
- UINT64_C( 1000 ) < p_sys->p_fp->i_preroll ) )
+ while( !p_sys->b_eos && ( p_sys->i_sendtime - p_sys->i_time - CHUNK < 0 ||
+ ( p_sys->i_sendtime - p_sys->i_time - CHUNK ) /
+ UINT64_C( 1000 ) < p_sys->p_fp->i_preroll ) )
{
/* Read and demux a packet */
if( DemuxASFPacket( &p_sys->packet_sys,
@@ -240,8 +241,9 @@ static int Demux( demux_t *p_demux )
p_sys->i_time = p_sys->i_sendtime;
}
- if( p_sys->b_eos || ( ( p_sys->i_sendtime - p_sys->i_time - CHUNK ) /
- UINT64_C( 1000 ) >= p_sys->p_fp->i_preroll ) )
+ if( !p_sys->b_eos && ( p_sys->i_sendtime - p_sys->i_time - CHUNK >= 0 &&
+ ( p_sys->i_sendtime - p_sys->i_time - CHUNK ) /
+ UINT64_C( 1000 ) >= p_sys->p_fp->i_preroll ) )
{
bool b_data = Block_Dequeue( p_demux, p_sys->i_time + CHUNK );
--
2.10.2
More information about the vlc-devel
mailing list