From: Stefano Sabatini <stefasab@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH] tools: add target_enc_fuzzer.c Date: Sat, 20 Apr 2024 09:50:19 +0200 Message-ID: <ZiNzu0n353KnLiir@mariano> (raw) In-Reply-To: <20240420011037.1162258-1-michael@niedermayer.cc> On date Saturday 2024-04-20 03:10:37 +0200, Michael Niedermayer wrote: > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > Makefile | 3 + > tools/Makefile | 3 + > tools/target_enc_fuzzer.c | 213 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 219 insertions(+) > create mode 100644 tools/target_enc_fuzzer.c > > diff --git a/Makefile b/Makefile > index b309dbc4db9..de727cbe00e 100644 > --- a/Makefile > +++ b/Makefile > @@ -52,6 +52,9 @@ $(TOOLS): %$(EXESUF): %.o > target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS) > $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) > > +target_enc_%_fuzzer$(EXESUF): target_enc_%_fuzzer.o $(FF_DEP_LIBS) > + $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) > + > tools/target_bsf_%_fuzzer$(EXESUF): tools/target_bsf_%_fuzzer.o $(FF_DEP_LIBS) > $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) > > diff --git a/tools/Makefile b/tools/Makefile > index 72e8e709a8d..2a11fa0ae62 100644 > --- a/tools/Makefile > +++ b/tools/Makefile > @@ -5,6 +5,9 @@ TOOLS-$(CONFIG_ZLIB) += cws2fws > tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c > $(COMPILE_C) -DFFMPEG_DECODER=$* > > +tools/target_enc_%_fuzzer.o: tools/target_enc_fuzzer.c > + $(COMPILE_C) -DFFMPEG_ENCODER=$* > + > tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c > $(COMPILE_C) -DFFMPEG_BSF=$* > > diff --git a/tools/target_enc_fuzzer.c b/tools/target_enc_fuzzer.c > new file mode 100644 > index 00000000000..bc9f98c1443 > --- /dev/null > +++ b/tools/target_enc_fuzzer.c > @@ -0,0 +1,213 @@ > +/* > + * Copyright (c) 2024 Michael Niedermayer <michael-ffmpeg@niedermayer.cc> > + * > + * 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 > + * > + * Based on target_dec_fuzzer > + */ > + > +#include "config.h" > +#include "libavutil/avassert.h" > +#include "libavutil/avstring.h" > +#include "libavutil/cpu.h" > +#include "libavutil/imgutils.h" > +#include "libavutil/intreadwrite.h" > +#include "libavutil/mem.h" > + > +#include "libavcodec/avcodec.h" > +#include "libavcodec/bytestream.h" > +#include "libavcodec/codec_internal.h" > +#include "libavformat/avformat.h" > + > +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); > + > +extern const FFCodec * codec_list[]; > + > +static void error(const char *err) > +{ > + fprintf(stderr, "%s", err); > + exit(1); > +} > + > +static const FFCodec *c = NULL; > +static const FFCodec *AVCodecInitialize(enum AVCodecID codec_id) nit: snake_case, also the function is used once and the code can be embedded in the code [...] _______________________________________________ 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".
next prev parent reply other threads:[~2024-04-20 7:50 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-20 1:10 Michael Niedermayer 2024-04-20 1:48 ` James Almer 2024-04-21 17:11 ` Michael Niedermayer 2024-04-20 7:50 ` Stefano Sabatini [this message] 2024-04-21 17:07 ` 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=ZiNzu0n353KnLiir@mariano \ --to=stefasab@gmail.com \ --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