Mercurial > libavformat.hg
comparison rmdec.c @ 4693:4de640349078 libavformat
Correctly skip complete INDX chunks, i.e. read the 32-bit header correctly
and if the size is broken (20 bytes, header-only), calculate the expected
size and skip the index entries anyway. See "[PATCH] rmdec.c: correctly
skip indexes" thread.
author | rbultje |
---|---|
date | Tue, 10 Mar 2009 12:55:29 +0000 |
parents | 71f1392ab8d4 |
children | a2390c6a35e6 |
comparison
equal
deleted
inserted
replaced
4692:71f1392ab8d4 | 4693:4de640349078 |
---|---|
438 *flags= 0; | 438 *flags= 0; |
439 }else{ | 439 }else{ |
440 state= (state<<8) + get_byte(pb); | 440 state= (state<<8) + get_byte(pb); |
441 | 441 |
442 if(state == MKBETAG('I', 'N', 'D', 'X')){ | 442 if(state == MKBETAG('I', 'N', 'D', 'X')){ |
443 len = get_be16(pb) - 6; | 443 int n_pkts, expected_len; |
444 len = get_be32(pb); | |
445 url_fskip(pb, 2); | |
446 n_pkts = get_be32(pb); | |
447 expected_len = 20 + n_pkts * 14; | |
448 if (len == 20) | |
449 /* some files don't add index entries to chunk size... */ | |
450 len = expected_len; | |
451 else if (len != expected_len) | |
452 av_log(s, AV_LOG_WARNING, | |
453 "Index size %d (%d pkts) is wrong, should be %d.\n", | |
454 len, n_pkts, expected_len); | |
455 len -= 14; // we already read part of the index header | |
444 if(len<0) | 456 if(len<0) |
445 continue; | 457 continue; |
446 goto skip; | 458 goto skip; |
447 } | 459 } |
448 | 460 |