On Thu, May 02, 2024 at 10:28:36AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: CID1492867 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
> > ---
> >  libavcodec/avs3_parser.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
> > index a819b5783d6..0f9076befe1 100644
> > --- a/libavcodec/avs3_parser.c
> > +++ b/libavcodec/avs3_parser.c
> > @@ -73,7 +73,9 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, 
> > const uint8_t *buf,
> >              GetBitContext gb;
> >              int profile, ratecode, low_delay;
> >  
> > -            init_get_bits8(&gb, buf + 4, buf_size - 4);
> > +            int ret = init_get_bits8(&gb, buf + 4, buf_size - 4);
> > +            if (ret < 0)
> > +                return;
> >  
> >              s->key_frame = 1;
> >              s->pict_type = AV_PICTURE_TYPE_I;
> 
> This code only reads/skips a few bits here (at most 100 if I counted
> correctly), so one could initialize the reader for a shorter length and
> assert that the call succeeds.

will apply:

-            init_get_bits8(&gb, buf + 4, buf_size - 4);
+            av_unused int ret = init_get_bits(&gb, buf + 4, 100);
+            av_assert1(ret >= 0);


thx

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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to