comparison avidec.c @ 5087:5de39afaca2e libavformat

Check size of "strf" header against size of enclosing "LIST" if there is one.
author reimar
date Fri, 03 Jul 2009 11:26:14 +0000
parents 33a244b7ca65
children 5da0e7ccc3c4
comparison
equal deleted inserted replaced
5086:5e6156776ee2 5087:5de39afaca2e
250 int i; 250 int i;
251 AVStream *st; 251 AVStream *st;
252 AVIStream *ast = NULL; 252 AVIStream *ast = NULL;
253 int avih_width=0, avih_height=0; 253 int avih_width=0, avih_height=0;
254 int amv_file_format=0; 254 int amv_file_format=0;
255 uint64_t list_end = 0;
255 256
256 avi->stream_index= -1; 257 avi->stream_index= -1;
257 258
258 if (get_riff(s, pb) < 0) 259 if (get_riff(s, pb) < 0)
259 return -1; 260 return -1;
275 print_tag("tag", tag, size); 276 print_tag("tag", tag, size);
276 #endif 277 #endif
277 278
278 switch(tag) { 279 switch(tag) {
279 case MKTAG('L', 'I', 'S', 'T'): 280 case MKTAG('L', 'I', 'S', 'T'):
281 list_end = url_ftell(pb) + size;
280 /* Ignored, except at start of video packets. */ 282 /* Ignored, except at start of video packets. */
281 tag1 = get_le32(pb); 283 tag1 = get_le32(pb);
282 #ifdef DEBUG 284 #ifdef DEBUG
283 print_tag("list", tag1, 0); 285 print_tag("list", tag1, 0);
284 #endif 286 #endif
443 case MKTAG('s', 't', 'r', 'f'): 445 case MKTAG('s', 't', 'r', 'f'):
444 /* stream header */ 446 /* stream header */
445 if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { 447 if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
446 url_fskip(pb, size); 448 url_fskip(pb, size);
447 } else { 449 } else {
450 uint64_t cur_pos = url_ftell(pb);
451 if (cur_pos < list_end)
452 size = FFMIN(size, list_end - cur_pos);
448 st = s->streams[stream_index]; 453 st = s->streams[stream_index];
449 switch(codec_type) { 454 switch(codec_type) {
450 case CODEC_TYPE_VIDEO: 455 case CODEC_TYPE_VIDEO:
451 if(amv_file_format){ 456 if(amv_file_format){
452 st->codec->width=avih_width; 457 st->codec->width=avih_width;