| 
																	
																	
																		
																	
																	
																 | 
																@@ -3120,6 +3120,19 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) | 
															
														
														
													
														
															
																 | 
																 | 
																        if (atom.size >= 8) { | 
																 | 
																 | 
																        if (atom.size >= 8) { | 
															
														
														
													
														
															
																 | 
																 | 
																            a.size = avio_rb32(pb); | 
																 | 
																 | 
																            a.size = avio_rb32(pb); | 
															
														
														
													
														
															
																 | 
																 | 
																            a.type = avio_rl32(pb); | 
																 | 
																 | 
																            a.type = avio_rl32(pb); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            if (a.type == MKTAG('f','r','e','e') && | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                a.size >= 8 && | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                c->moov_retry) { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                uint8_t buf[8]; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                uint32_t *type = (uint32_t *)buf + 1; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                avio_read(pb, buf, 8); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                avio_seek(pb, -8, SEEK_CUR); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                if (*type == MKTAG('m','v','h','d') || | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    *type == MKTAG('c','m','o','v')) { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    av_log(c->fc, AV_LOG_ERROR, "Detected moov in a free atom.\n"); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    a.type = MKTAG('m','o','o','v'); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																            if (atom.type != MKTAG('r','o','o','t') && | 
																 | 
																 | 
																            if (atom.type != MKTAG('r','o','o','t') && | 
															
														
														
													
														
															
																 | 
																 | 
																                atom.type != MKTAG('m','o','o','v')) | 
																 | 
																 | 
																                atom.type != MKTAG('m','o','o','v')) | 
															
														
														
													
														
															
																 | 
																 | 
																            { | 
																 | 
																 | 
																            { | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -3486,11 +3499,15 @@ static int mov_read_header(AVFormatContext *s) | 
															
														
														
													
														
															
																 | 
																 | 
																        atom.size = INT64_MAX; | 
																 | 
																 | 
																        atom.size = INT64_MAX; | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																    /* check MOV header */ | 
																 | 
																 | 
																    /* check MOV header */ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    do { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    if (mov->moov_retry) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        avio_seek(pb, 0, SEEK_SET); | 
															
														
														
													
														
															
																 | 
																 | 
																    if ((err = mov_read_default(mov, pb, atom)) < 0) { | 
																 | 
																 | 
																    if ((err = mov_read_default(mov, pb, atom)) < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																        av_log(s, AV_LOG_ERROR, "error reading header: %d\n", err); | 
																 | 
																 | 
																        av_log(s, AV_LOG_ERROR, "error reading header: %d\n", err); | 
															
														
														
													
														
															
																 | 
																 | 
																        mov_read_close(s); | 
																 | 
																 | 
																        mov_read_close(s); | 
															
														
														
													
														
															
																 | 
																 | 
																        return err; | 
																 | 
																 | 
																        return err; | 
															
														
														
													
														
															
																 | 
																 | 
																    } | 
																 | 
																 | 
																    } | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    } while (pb->seekable && !mov->found_moov && !mov->moov_retry++); | 
															
														
														
													
														
															
																 | 
																 | 
																    if (!mov->found_moov) { | 
																 | 
																 | 
																    if (!mov->found_moov) { | 
															
														
														
													
														
															
																 | 
																 | 
																        av_log(s, AV_LOG_ERROR, "moov atom not found\n"); | 
																 | 
																 | 
																        av_log(s, AV_LOG_ERROR, "moov atom not found\n"); | 
															
														
														
													
														
															
																 | 
																 | 
																        mov_read_close(s); | 
																 | 
																 | 
																        mov_read_close(s); | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																	
																 | 
																
  |