changeset 24455:3ae0e3067f99

Move boundary check before use!
author reimar
date Fri, 14 Sep 2007 16:58:31 +0000
parents 47ec03fe8911
children 41c163b6bea4
files libmpdemux/demux_ty.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ty.c	Fri Sep 14 16:50:42 2007 +0000
+++ b/libmpdemux/demux_ty.c	Fri Sep 14 16:58:31 2007 +0000
@@ -197,6 +197,10 @@
 
       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 @@
            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 )