Commit 227d602b authored by Marijn Meijles's avatar Marijn Meijles Committed by Michael Niedermayer

avformat/ac3dec: Fix to prevent runaway ac3 detection by looking at the actual...

avformat/ac3dec: Fix to prevent runaway ac3 detection by looking at the actual frame rather than the first detected frame.

When detecting a swapped AC3 marker the data of the frame is swapped. However, in subsequent frames the data swapped is taken from the first frame rather than the current frame.
Signed-off-by: 's avatarMarijn Meijles <marijn@bitpit.net>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 65862f57
...@@ -49,8 +49,8 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id) ...@@ -49,8 +49,8 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id)
buf2+=16; buf2+=16;
if (buf[0] == 0x77 && buf[1] == 0x0B) { if (buf[0] == 0x77 && buf[1] == 0x0B) {
for(i=0; i<8; i+=2) { for(i=0; i<8; i+=2) {
buf3[i ] = buf[i+1]; buf3[i ] = buf2[i+1];
buf3[i+1] = buf[i ]; buf3[i+1] = buf2[i ];
} }
init_get_bits(&gbc, buf3, 54); init_get_bits(&gbc, buf3, 54);
}else }else
...@@ -62,8 +62,8 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id) ...@@ -62,8 +62,8 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id)
if (buf[0] == 0x77 && buf[1] == 0x0B) { if (buf[0] == 0x77 && buf[1] == 0x0B) {
av_assert0(phdr->frame_size <= sizeof(buf3)); av_assert0(phdr->frame_size <= sizeof(buf3));
for(i=8; i<phdr->frame_size; i+=2) { for(i=8; i<phdr->frame_size; i+=2) {
buf3[i ] = buf[i+1]; buf3[i ] = buf2[i+1];
buf3[i+1] = buf[i ]; buf3[i+1] = buf2[i ];
} }
} }
if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, gbc.buffer + 2, phdr->frame_size - 2)) if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, gbc.buffer + 2, phdr->frame_size - 2))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment