[FFmpeg-devel] [PATCHv2] fate/integer.c: Connect test to fuzzer

Michael Niedermayer michael at niedermayer.cc
Fri May 7 18:23:38 EEST 2021


On Thu, May 06, 2021 at 10:34:50PM +0530, Vedaa wrote:
> Hi,
> 
> I have made the requisite changes. 

[...]

> +++ b/libavutil/tests/integer.h
> @@ -0,0 +1,43 @@
> +/*
> + * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include <stdint.h>
> +
> +#include "libavutil/avassert.h"
> +#include "libavutil/integer.h"
> +#include "libavutil/intmath.h"
> +
> +static inline void TestInteger(int64_t a, int64_t b)
> +{
> +        AVInteger ai= av_int2i(a);
> +        AVInteger bi= av_int2i(b);
> +
> +        av_assert0(av_i2int(ai) == a);
> +        av_assert0(av_i2int(bi) == b);
> +        av_assert0(av_i2int(av_add_i(ai,bi)) == a+b);
> +        av_assert0(av_i2int(av_sub_i(ai,bi)) == a-b);
> +        av_assert0(av_i2int(av_mul_i(ai,bi)) == a*b);
> +        av_assert0(av_i2int(av_shr_i(ai, 9)) == a>>9);
> +        av_assert0(av_i2int(av_shr_i(ai,-9)) == a<<9);
> +        av_assert0(av_i2int(av_shr_i(ai, 17)) == a>>17);
> +        av_assert0(av_i2int(av_shr_i(ai,-17)) == a<<17);
> +        av_assert0(av_log2_i(ai) == av_log2(a));
> +        av_assert0(av_i2int(av_div_i(ai,bi)) == a/b);
> +}

missing standard inclusion guards, see other headers


[...]
> diff --git a/tools/target_int_fuzzer.c b/tools/target_int_fuzzer.c
> new file mode 100644
> index 0000000000..811f410b1a
> --- /dev/null
> +++ b/tools/target_int_fuzzer.c
> @@ -0,0 +1,35 @@
> +/*

> + * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>

thats not correct, you are the author

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin
-------------- 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/20210507/93da02ae/attachment.sig>


More information about the ffmpeg-devel mailing list