[MPlayer-cvslog] r37648 - trunk/libmpdemux/demux_mov.c

reimar subversion at mplayerhq.hu
Tue Feb 9 23:19:05 CET 2016


Author: reimar
Date: Tue Feb  9 23:19:05 2016
New Revision: 37648

Log:
demux_mov: Move sanity check one level up.

Modified:
   trunk/libmpdemux/demux_mov.c

Modified: trunk/libmpdemux/demux_mov.c
==============================================================================
--- trunk/libmpdemux/demux_mov.c	Tue Feb  9 23:11:52 2016	(r37647)
+++ trunk/libmpdemux/demux_mov.c	Tue Feb  9 23:19:05 2016	(r37648)
@@ -742,8 +742,8 @@ static int gen_sh_audio(sh_audio_t* sh,
 		    int fcc=char2int(trak->stdata,48);
 		    // we have extra audio headers!!!
 		    mp_msg(MSGT_DEMUX,MSGL_V,"Audio extra header: len=%d  fcc=0x%X\n",len,fcc);
-		    if((len >= 4) &&
-		       (char2int(trak->stdata,52) >= 12) &&
+		    if (len > 8 && len <= trak->stdata_len - 44) {
+		    if((char2int(trak->stdata,52) >= 12) &&
 		       (char2int(trak->stdata,52+4) == MOV_FOURCC('f','r','m','a'))) {
 			int frma_len = char2int(trak->stdata,52);
 			switch(char2int(trak->stdata,52+8)) {
@@ -767,18 +767,15 @@ static int gen_sh_audio(sh_audio_t* sh,
 			  }
 		          break;
 		         default:
-			  if (len > 8 && len <= trak->stdata_len - 44) {
 				sh->codecdata_len = len-8;
 				sh->codecdata = malloc(sh->codecdata_len);
 				memcpy(sh->codecdata, trak->stdata+44+8, sh->codecdata_len);
-			  }
 		        }
 		    } else {
-		      if (len > 8 && len <= trak->stdata_len - 44) {
 		    sh->codecdata_len = len-8;
 		    sh->codecdata = malloc(sh->codecdata_len);
 		    memcpy(sh->codecdata, trak->stdata+44+8, sh->codecdata_len);
-		      }
+		    }
 		    }
 		  }
 		}


More information about the MPlayer-cvslog mailing list