[FFmpeg-devel] [PATCH 5/5] avcodec/atrac9dec: Check init_get_bits8() for failure

Michael Niedermayer michael at niedermayer.cc
Wed May 1 01:53:15 EEST 2024


On Sun, Apr 28, 2024 at 11:41:48PM +0200, Lynne wrote:
> Apr 28, 2024, 23:31 by michael at niedermayer.cc:
> 
> > Fixes: CID1439569 Unchecked return value
> > Fixes: CID1439578 Unchecked return value
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/atrac9dec.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
> > index df68407af92..e375f46fd04 100644
> > --- a/libavcodec/atrac9dec.c
> > +++ b/libavcodec/atrac9dec.c
> > @@ -802,7 +802,9 @@ static int atrac9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
> >  if (ret < 0)
> >  return ret;
> >  
> > -    init_get_bits8(&gb, avpkt->data, avpkt->size);
> > +    ret = init_get_bits8(&gb, avpkt->data, avpkt->size);
> > +    if (ret < 0)
> > +        return ret;
> >  
> >  for (int i = 0; i < frames; i++) {
> >  for (int j = 0; j < s->block_config->count; j++) {
> > @@ -922,7 +924,9 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx)
> >  return AVERROR_INVALIDDATA;
> >  }
> >  
> > -    init_get_bits8(&gb, avctx->extradata + 4, avctx->extradata_size);
> > +    err = init_get_bits8(&gb, avctx->extradata + 4, avctx->extradata_size);
> > +    if (err < 0)
> > +        return err;
> >  
> >  if (get_bits(&gb, 8) != 0xFE) {
> >  av_log(avctx, AV_LOG_ERROR, "Incorrect magic byte!\n");
> >
> 
> This and ac3 lgtm

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240501/4da9395e/attachment.sig>


More information about the ffmpeg-devel mailing list