From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8652142112 for ; Sat, 20 Apr 2024 07:50:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0373B68D1FA; Sat, 20 Apr 2024 10:50:30 +0300 (EEST) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 86B0468CAA7 for ; Sat, 20 Apr 2024 10:50:23 +0300 (EEST) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a5224dfa9adso479937766b.0 for ; Sat, 20 Apr 2024 00:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713599422; x=1714204222; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=zNvBU68ciN5wfQxaVGoh1SOyw8Dx1lQKLC/J3bBYF+s=; b=GwkzYW4cYMMDdBs6wAQO6EXH/mBb0UmYMBEINO+5Y/rybXavkexLiXbYkp6juVSsH4 xyy32p1Dz+1PKRtNZptRYDi6ji/CQjAok1jIhKS5mmyKKGR7ZwSG9IGw7iyQa/FLzzgo R/itOYvbDwQX8z44Vsc62mxVsYGKx+nFrYAn5tDMo2+QIvbqdO8t84fLq/xQGy6L0I9m py2Ar4fl6eMNLR+sZ9bsr6Dc6UvCdieUW9IPbxEZplquL8Fx9qZhxAb8zdpzxaWoRku2 G7WqjaIHypQ3T+PjnFUjpDlkFR344BqE1gTQIGnljqI6Oakacz4nXsFBUznveBxcDnB+ 7o9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713599422; x=1714204222; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=zNvBU68ciN5wfQxaVGoh1SOyw8Dx1lQKLC/J3bBYF+s=; b=vnvYGoOOBbzp5Yl1xKI0OtrtZQlPJ/q/R6DsvmkAg9Xfat8XkxSZtFdDeYWYsEP3eX 8S0U0PYgKrU4+7MdIKpA7R8j7NSCRxr/Sp/qWIh/EWJUobjRNhFjfToA8bpiUZUoaeGG wuzNtkafg6n+fYom4I4/1Wn7ALtIF6eTWqjikqQLxUkNAMF5pcpyp3JNchm8YmQFS2PW UJB1UBhsy7kPMxV1m7Lg1C9OuUdMQtZfFAfTtf+mcJf7CKvjSL3BAwktZpH/lSJtOwdU 1kMrOjUSdpSEMTPwzIjt9TTBh+F1fVU7xGwBqmPj3t+UmVZ4WfpQs8Esii3xzqgsI+6V 1A5g== X-Gm-Message-State: AOJu0Yz7gLWRb0tR/z8gxcpmFmAYUAH3Pzk/w2T9xmLRkqp60QmJwecm Z1aMloIjVUGSTWj0xtqYy0grlZh59SpfqhPdrg2v0fIx6cBxfT4OnLsrIQ== X-Google-Smtp-Source: AGHT+IHxkw01gzQ10PvLWlLCY4AyCsjICSXWb5J0sZPheRl1ZMDKFVu53mQRy4drZwqTtVRB68nG6w== X-Received: by 2002:a17:906:6817:b0:a55:358f:e497 with SMTP id k23-20020a170906681700b00a55358fe497mr7057468ejr.18.1713599421637; Sat, 20 Apr 2024 00:50:21 -0700 (PDT) Received: from mariano (host-87-17-49-61.retail.telecomitalia.it. [87.17.49.61]) by smtp.gmail.com with ESMTPSA id s11-20020a170906bc4b00b00a522911e2aesm3080227ejv.124.2024.04.20.00.50.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 00:50:21 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id D6879BFCE8; Sat, 20 Apr 2024 09:50:19 +0200 (CEST) Date: Sat, 20 Apr 2024 09:50:19 +0200 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20240420011037.1162258-1-michael@niedermayer.cc> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240420011037.1162258-1-michael@niedermayer.cc> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH] tools: add target_enc_fuzzer.c X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On date Saturday 2024-04-20 03:10:37 +0200, Michael Niedermayer wrote: > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Michael Niedermayer > --- > 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 > + * > + * 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".