summaryrefslogtreecommitdiff
path: root/libavcodec/ac3_parser.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2022-10-22 16:41:41 -0300
committerJames Almer <jamrial@gmail.com>2022-10-26 10:18:33 -0300
commit4c35bb53f94e4de88a0919346f24d34f8387771c (patch)
treed1f6b43ab9cd13b671a64693e551acb03bade290 /libavcodec/ac3_parser.c
parentffb691878359fd80c0b675e015765ccd0d2d467e (diff)
downloadffmpeg-4c35bb53f94e4de88a0919346f24d34f8387771c.tar.gz
avcodec/ac3_parser: improve false positive detection when parsing sync frames
A two byte sync word is not enough to ensure we got a real syncframe, nor are all the range checks we do in the first seven bytes. Do therefore an integrity check for the sync frame in order to prevent the parser from filling avctx with bogus information. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/ac3_parser.c')
-rw-r--r--libavcodec/ac3_parser.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 8885e1c72e..13b8d3b7d8 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -246,6 +246,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
{
AACAC3ParseContext *s = s1->priv_data;
s->header_size = AC3_HEADER_SIZE;
+ s->crc_ctx = av_crc_get_table(AV_CRC_16_ANSI);
s->sync = ac3_sync;
return 0;
}