diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-06-27 16:59:13 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-16 19:02:12 +0200 |
commit | 0003ace83b18f68c981c8ad401bee75315edf9f5 (patch) | |
tree | 799227e0ba8c22f511d855ba79776f9c901496f2 | |
parent | 20c5fb972101fa25dedaf35a9c0ce2bf02fa6b52 (diff) | |
download | ffmpeg-0003ace83b18f68c981c8ad401bee75315edf9f5.tar.gz |
avcodec/ac3_parser: Check init_get_bits8() for failure
Fixes: null pointer dereference
Fixes: ffmpeg_crash_6.avi
Found-by: Thuan Pham, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 00e8181bd97c834fe60751b0c511d4bb97875f78)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/ac3_parser.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index f4618bf215..1e203ae6ac 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -162,7 +162,9 @@ int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf, return AVERROR(ENOMEM); hdr = *phdr; - init_get_bits8(&gb, buf, size); + err = init_get_bits8(&gb, buf, size); + if (err < 0) + return AVERROR_INVALIDDATA; err = ff_ac3_parse_header(&gb, hdr); if (err < 0) return AVERROR_INVALIDDATA; |