[FFmpeg-devel] [PATCH 1/2] libavfilter/signature_lookup: fix possible division by zero

Michael Niedermayer michael at niedermayer.cc
Tue May 7 20:46:28 EEST 2024


On Mon, May 06, 2024 at 12:30:39AM +0200, Gerion Entrup wrote:
> ---
>  libavfilter/signature_lookup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c
> index a0ca818a9b..b39a3e225b 100644
> --- a/libavfilter/signature_lookup.c
> +++ b/libavfilter/signature_lookup.c
> @@ -128,7 +128,7 @@ static int get_jaccarddist(SignatureContext *sc, CoarseSignature *first, CoarseS
>      int jaccarddist, i, composdist = 0, cwthcount = 0;
>      for (i = 0; i < 5; i++) {
>          if ((jaccarddist = intersection_word(first->data[i], second->data[i])) > 0) {
> -            jaccarddist /= union_word(first->data[i], second->data[i]);
> +            jaccarddist /= FFMAX(union_word(first->data[i], second->data[i]), 1);
>          }

for which input data does this cause a division by 0 ?

thx

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- 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/20240507/fe92be15/attachment.sig>


More information about the ffmpeg-devel mailing list