Skip to content
Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
maryam ebrahimzadeh authored and michaelni committed Aug 6, 2021
1 parent 89505d3 commit 9ffa494
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libavformat/adtsenc.c
Expand Up @@ -53,9 +53,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_config2(&m4ac, buf, size, 1, s);
if (off < 0)
return off;
Expand Down

1 comment on commit 9ffa494

@meweez
Copy link
Contributor

@meweez meweez commented on 9ffa494 Aug 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.