# HG changeset patch # User rbultje # Date 1236689729 0 # Node ID 4de6403490787637957c8125b03691a3a27bb98f # Parent 71f1392ab8d46e2b0abbb59b8d33830294b23b98 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. diff -r 71f1392ab8d4 -r 4de640349078 rmdec.c --- a/rmdec.c Mon Mar 09 22:03:47 2009 +0000 +++ b/rmdec.c Tue Mar 10 12:55:29 2009 +0000 @@ -440,7 +440,19 @@ state= (state<<8) + get_byte(pb); if(state == MKBETAG('I', 'N', 'D', 'X')){ - len = get_be16(pb) - 6; + int n_pkts, expected_len; + len = get_be32(pb); + url_fskip(pb, 2); + n_pkts = get_be32(pb); + expected_len = 20 + n_pkts * 14; + if (len == 20) + /* some files don't add index entries to chunk size... */ + len = expected_len; + else if (len != expected_len) + av_log(s, AV_LOG_WARNING, + "Index size %d (%d pkts) is wrong, should be %d.\n", + len, n_pkts, expected_len); + len -= 14; // we already read part of the index header if(len<0) continue; goto skip;