diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-09-14 16:58:31 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-09-14 16:58:31 +0000 |
commit | 4e9311b1de76db229befb6936c6fcbe9e953baef (patch) | |
tree | faa1b19f045e82cf8decfa7472ceea127b1904f2 /libmpdemux | |
parent | b7f2c746cc9bfd8e2b957495f258f1381c18ce7b (diff) |
Move boundary check before use!
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24475 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_ty.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libmpdemux/demux_ty.c b/libmpdemux/demux_ty.c index 62d126f7ec..bfd85b7d01 100644 --- a/libmpdemux/demux_ty.c +++ b/libmpdemux/demux_ty.c @@ -197,6 +197,10 @@ static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo ) if ( isty ) { + if ( parts >= MAX_TMF_PARTS ) { + mp_msg( MSGT_DEMUX, MSGL_ERR, "ty:tmf too big\n" ); + break; + } tivo->tmfparts[ parts ].fileNo = parts; tivo->tmfparts[ parts ].fileSize = size; tivo->tmfparts[ parts ].startOffset = offset + 512; @@ -222,8 +226,6 @@ static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo ) tivo->tmfparts[ parts ].startOffset ); parts++; - if ( parts > MAX_TMF_PARTS ) - mp_msg( MSGT_DEMUX, MSGL_ERR, "ty:tmf too big\n" ); } if ( ( offset + skip ) > totalsize ) |