aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaryam ebrahimzadeh <me22bee@outlook.com>2021-08-04 16:15:18 -0400
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-17 21:34:53 +0200
commita5f40432b4deeae9b371e5a2d4395343ffcfa359 (patch)
tree0326d580736f2ad19f14f851bc78a77e10ad362b
parent04e938dc677b714b906c17f125bacc8a0c21d344 (diff)
downloadffmpeg-a5f40432b4deeae9b371e5a2d4395343ffcfa359.tar.gz
avformat/adtsenc: return value check for init_get_bits in adts_decode_extradata
As the second argument for init_get_bits (buf) can be crafted, a return value check for this function call is necessary. 'buf' is part of 'AVPacket pkt'. replace init_get_bits with init_get_bits8. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 9ffa49496d1aae4cbbb387aac28a9e061a6ab0a6) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/adtsenc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 7448ec794f..42901e234b 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -50,9 +50,11 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui
GetBitContext gb;
PutBitContext pb;
MPEG4AudioConfig m4ac;
- int off;
+ int off, ret;
- init_get_bits(&gb, buf, size * 8);
+ ret = init_get_bits8(&gb, buf, size);
+ if (ret < 0)
+ return ret;
off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
if (off < 0)
return off;