4xmdemux: Check chunk size
Fixes over reading the header array
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 474e31c904)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
			
			
This commit is contained in:
		@@ -127,6 +127,10 @@ static int fourxm_read_header(AVFormatContext *s,
 | 
				
			|||||||
    for (i = 0; i < header_size - 8; i++) {
 | 
					    for (i = 0; i < header_size - 8; i++) {
 | 
				
			||||||
        fourcc_tag = AV_RL32(&header[i]);
 | 
					        fourcc_tag = AV_RL32(&header[i]);
 | 
				
			||||||
        size = AV_RL32(&header[i + 4]);
 | 
					        size = AV_RL32(&header[i + 4]);
 | 
				
			||||||
 | 
					        if (size > header_size - i - 8 && (fourcc_tag == vtrk_TAG || fourcc_tag == strk_TAG)) {
 | 
				
			||||||
 | 
					            av_log(s, AV_LOG_ERROR, "chunk larger than array %d>%d\n", size, header_size - i - 8);
 | 
				
			||||||
 | 
					            return AVERROR_INVALIDDATA;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (fourcc_tag == std__TAG) {
 | 
					        if (fourcc_tag == std__TAG) {
 | 
				
			||||||
            fourxm->fps = av_int2flt(AV_RL32(&header[i + 12]));
 | 
					            fourxm->fps = av_int2flt(AV_RL32(&header[i + 12]));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user