Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 2/3] avfilter/signature_lookup: Initialize bestmatch
Date: Mon, 22 Apr 2024 04:09:37 +0200
Message-ID: <20240422020937.GB6420@pb2> (raw)
In-Reply-To: <AS8P250MB0744CBB4D95F1FA2B87A926C8F132@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>


[-- Attachment #1.1: Type: text/plain, Size: 1932 bytes --]

On Mon, Apr 22, 2024 at 01:10:47AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: CID1500345 Uninitialized scalar variable
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavfilter/signature_lookup.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c
> > index a3086b38cca..dc0a2ef2b24 100644
> > --- a/libavfilter/signature_lookup.c
> > +++ b/libavfilter/signature_lookup.c
> > @@ -535,16 +535,14 @@ static MatchingInfo lookup_signatures(AVFilterContext *ctx, SignatureContext *sc
> >  {
> >      CoarseSignature *cs, *cs2;
> >      MatchingInfo *infos;
> > -    MatchingInfo bestmatch;
> > +    MatchingInfo bestmatch = {0};
> >      MatchingInfo *i;
> >  
> >      cs = first->coarsesiglist;
> >      cs2 = second->coarsesiglist;
> >  
> >      /* score of bestmatch is 0, if no match is found */
> > -    bestmatch.score = 0;
> >      bestmatch.meandist = 99999;
> > -    bestmatch.whole = 0;
> >  
> >      fill_l1distlut(sc->l1distlut);
> >  
> 
> Does this fix an actual bug or just suppress a Coverity warning?

returning partially initialized structs is IMHO bad practice
it is strictly not a bug i guess.
But its similar to not initializing pointers to NULL and then
having to track if all paths initialize them before freeing.

This is similar. With passing partially initialized structs around,
one would have to ensure that nothing is touched that isnt initialized.
Ive marked the issue as false positive now as that is in fact more
correct.

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

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

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

  reply	other threads:[~2024-04-22  2:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-21 23:06 [FFmpeg-devel] [PATCH 1/3] avfilter/signature_lookup: Fix 2 differences to the refernce SW Michael Niedermayer
2024-04-21 23:07 ` [FFmpeg-devel] [PATCH 2/3] avfilter/signature_lookup: Initialize bestmatch Michael Niedermayer
2024-04-21 23:10   ` Andreas Rheinhardt
2024-04-22  2:09     ` Michael Niedermayer [this message]
2024-04-21 23:07 ` [FFmpeg-devel] [PATCH 3/3] avfilter/signature_lookup: Dont copy uninitialized stuff around Michael Niedermayer
2024-04-24  0:49   ` Michael Niedermayer
2024-04-24  0:49 ` [FFmpeg-devel] [PATCH 1/3] avfilter/signature_lookup: Fix 2 differences to the refernce SW Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240422020937.GB6420@pb2 \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git