[FFmpeg-devel] [PATCH] fate/integer.c: Connect test to fuzzer
Michael Niedermayer
michael at niedermayer.cc
Mon May 3 16:28:33 EEST 2021
On Mon, May 03, 2021 at 04:04:28PM +0530, Vedaa wrote:
> Hi,
>
> I am applying for GSoC '21. I have attempted to connect fate-integer to the
> fuzzer by using a header file with the test function to ensure code
> reusability. However, the linker is unable to link the function definiton.
> What changes should I make to properly link the function?
The fate tests are seperate excutables and not part of the libraraies
so linking to the libraraies will not include the code from the fate
tests
you can either move the code itself to a static inline function in a header
and include that by both the fate test and the fuzzer. Or you can change the
excutabel of the test so it takes the parameters via the command line and
then execute the excutable with fuzzed parameters
There are other possibilities too, these are just the 2 most obvious
more comments below
[...]
> +++ b/Makefile
> @@ -62,6 +62,8 @@ tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
> tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
> $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
>
> +target_int_fuzzer$(EXESUF): tools/target_int_fuzzer.o $(FF_DEP_LIBS)
tools/target_int_fuzzer$ ...
[...]
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include <libavutil/tests/integer.h>
> +
> +int LLVMFuzzerTestOneInput( const uint8_t *data, size_t size ) {
missing prototype, see the othert fuzzers
> + if (size < 2 * sizeof(int64_t))
> + return 1;
> +
> + int64_t a,b;
> + memcpy(&a,data,sizeof(int64_t));
> + memcpy(&b,&(data[sizeof(int64_t)]),sizeof(int64_t));
AV_RB64() otherwise fuzzer samples would behave different on big endian
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- 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/20210503/a5cf7c07/attachment.sig>
More information about the ffmpeg-devel
mailing list