[FFmpeg-devel] [PATCH 2/7] avcodec/av1dec: initialize ret in av1_receive_frame_internal()

Michael Niedermayer michael at niedermayer.cc
Fri May 3 00:29:39 EEST 2024


On Thu, May 02, 2024 at 09:12:36AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: CID1596605 Uninitialized scalar variable
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/av1dec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> > index 4f9222cca27..93ab04eb378 100644
> > --- a/libavcodec/av1dec.c
> > +++ b/libavcodec/av1dec.c
> > @@ -1262,7 +1262,7 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
> >  {
> >      AV1DecContext *s = avctx->priv_data;
> >      AV1RawTileGroup *raw_tile_group = NULL;
> > -    int i = 0, ret;
> > +    int i = 0, ret = 0;
> >  
> >      for (i = s->nb_unit; i < s->current_obu.nb_units; i++) {
> >          CodedBitstreamUnit *unit = &s->current_obu.units[i];
> 
> A better approach is to actually initialize ret before every goto end in
> order to ensure that only the actually desired ret is returned and not
> some earlier value.

ok, will apply with ret = 0 before the 2 goto end lacking it that i see

thx

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

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- 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/20240502/3eae625d/attachment.sig>


More information about the ffmpeg-devel mailing list