* [FFmpeg-devel] [PATCH v2 0/4] Minor fixes and for fuzzing targets @ 2025-06-06 17:20 Kacper Michajłow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement Kacper Michajłow ` (3 more replies) 0 siblings, 4 replies; 8+ messages in thread From: Kacper Michajłow @ 2025-06-06 17:20 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Kacper Michajłow Minor fixes and for fuzzing targets. Mostly motivated to reduce spam in the build log. v2 only for rebase only. Kacper Michajłow (4): tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement tools/target_dec_fuzzer: suppress Wunused-function tools/target_dem_fuzzer: make fuzz data pointer constant tools/target_dem_fuzzer: remove unused fuzz_tag tools/target_dec_fuzzer.c | 34 +++++++++++++++++++++------------- tools/target_dem_fuzzer.c | 5 +---- 2 files changed, 22 insertions(+), 17 deletions(-) -- 2.49.0 _______________________________________________ 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". ^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement 2025-06-06 17:20 [FFmpeg-devel] [PATCH v2 0/4] Minor fixes and for fuzzing targets Kacper Michajłow @ 2025-06-06 17:20 ` Kacper Michajłow 2025-06-06 21:49 ` Michael Niedermayer 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 2/4] tools/target_dec_fuzzer: suppress Wunused-function Kacper Michajłow ` (2 subsequent siblings) 3 siblings, 1 reply; 8+ messages in thread From: Kacper Michajłow @ 2025-06-06 17:20 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Kacper Michajłow To avoid spam in log, each fuzzer is built separately so it's amplified a lot. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> --- tools/target_dec_fuzzer.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index dfff167f78..7afb23619e 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -187,6 +187,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { uint64_t keyframes = 0; uint64_t flushpattern = -1; AVDictionary *opts = NULL; + AVCodecContext* ctx; + AVCodecContext* parser_avctx; + AVFrame *frame; + AVPacket *avpkt; + AVPacket *parsepkt; + int res; + int got_frame; if (!c) { #ifdef FFMPEG_DECODER @@ -339,8 +346,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { maxsamples_per_frame = FFMIN(maxsamples_per_frame, maxsamples); maxpixels_per_frame = FFMIN(maxpixels_per_frame , maxpixels); - AVCodecContext* ctx = avcodec_alloc_context3(&c->p); - AVCodecContext* parser_avctx = avcodec_alloc_context3(NULL); + ctx = avcodec_alloc_context3(&c->p); + parser_avctx = avcodec_alloc_context3(NULL); if (!ctx || !parser_avctx) error("Failed memory allocation"); @@ -470,7 +477,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ctx->width = ctx->height = 0; } - int res = avcodec_open2(ctx, &c->p, &opts); + res = avcodec_open2(ctx, &c->p, &opts); if (res < 0) { av_assert0(res != AVERROR_BUG); avcodec_free_context(&ctx); @@ -483,11 +490,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { parser_avctx->extradata_size = ctx->extradata_size; parser_avctx->extradata = ctx->extradata ? av_memdup(ctx->extradata, ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE) : NULL; - - int got_frame; - AVFrame *frame = av_frame_alloc(); - AVPacket *avpkt = av_packet_alloc(); - AVPacket *parsepkt = av_packet_alloc(); + frame = av_frame_alloc(); + avpkt = av_packet_alloc(); + parsepkt = av_packet_alloc(); if (!frame || !avpkt || !parsepkt) error("Failed memory allocation"); @@ -563,7 +568,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { // Iterate through all data while (decode_more && it++ < maxiteration) { av_frame_unref(frame); - int ret = decode_handler(ctx, frame, &got_frame, avpkt); + res = decode_handler(ctx, frame, &got_frame, avpkt); ec_pixels += (ctx->width + 32LL) * (ctx->height + 32LL); if (it > 20 || ec_pixels > 4 * ctx->max_pixels) { @@ -582,15 +587,15 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (nb_samples > maxsamples) goto maximums_reached; - if (ret <= 0 || ret > avpkt->size) + if (res <= 0 || res > avpkt->size) break; if (ctx->codec_type == AVMEDIA_TYPE_SUBTITLE) { - avpkt->data += ret; - avpkt->size -= ret; + avpkt->data += res; + avpkt->size -= res; decode_more = avpkt->size > 0; } else - decode_more = ret >= 0; + decode_more = res >= 0; } av_packet_unref(avpkt); } -- 2.49.0 _______________________________________________ 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". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement Kacper Michajłow @ 2025-06-06 21:49 ` Michael Niedermayer 2025-06-07 13:46 ` Kacper Michajlow 0 siblings, 1 reply; 8+ messages in thread From: Michael Niedermayer @ 2025-06-06 21:49 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 587 bytes --] Hi Kacper On Fri, Jun 06, 2025 at 07:20:32PM +0200, Kacper Michajłow wrote: > To avoid spam in log, each fuzzer is built separately so it's amplified > a lot. > > Signed-off-by: Kacper Michajłow <kasper93@gmail.com> > --- > tools/target_dec_fuzzer.c | 31 ++++++++++++++++++------------- > 1 file changed, 18 insertions(+), 13 deletions(-) i suggest to remove Wdeclaration-after-statement rather thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Some Animals are More Equal Than Others. - George Orwell's book Animal Farm [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ 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". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement 2025-06-06 21:49 ` Michael Niedermayer @ 2025-06-07 13:46 ` Kacper Michajlow 0 siblings, 0 replies; 8+ messages in thread From: Kacper Michajlow @ 2025-06-07 13:46 UTC (permalink / raw) To: FFmpeg development discussions and patches On Fri, 6 Jun 2025 at 23:49, Michael Niedermayer <michael@niedermayer.cc> wrote: > > Hi Kacper > > On Fri, Jun 06, 2025 at 07:20:32PM +0200, Kacper Michajłow wrote: > > To avoid spam in log, each fuzzer is built separately so it's amplified > > a lot. > > > > Signed-off-by: Kacper Michajłow <kasper93@gmail.com> > > --- > > tools/target_dec_fuzzer.c | 31 ++++++++++++++++++------------- > > 1 file changed, 18 insertions(+), 13 deletions(-) > > i suggest to remove Wdeclaration-after-statement rather I see it has recently been removed in configure as 890b8da1ce27fd365eaffefc7efcbadae9f01f2a. So indeed those changes are not needed anymore. Thanks for merging the rest of the patches. - Kacper _______________________________________________ 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". ^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH v2 2/4] tools/target_dec_fuzzer: suppress Wunused-function 2025-06-06 17:20 [FFmpeg-devel] [PATCH v2 0/4] Minor fixes and for fuzzing targets Kacper Michajłow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement Kacper Michajłow @ 2025-06-06 17:20 ` Kacper Michajłow 2025-06-07 12:30 ` Michael Niedermayer 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 3/4] tools/target_dem_fuzzer: make fuzz data pointer constant Kacper Michajłow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 4/4] tools/target_dem_fuzzer: remove unused fuzz_tag Kacper Michajłow 3 siblings, 1 reply; 8+ messages in thread From: Kacper Michajłow @ 2025-06-06 17:20 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Kacper Michajłow Signed-off-by: Kacper Michajłow <kasper93@gmail.com> --- tools/target_dec_fuzzer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index 7afb23619e..6950d134d9 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -72,6 +72,8 @@ static void error(const char *err) } static const FFCodec *c = NULL; + +#ifndef FFMPEG_DECODER static const FFCodec *AVCodecInitialize(enum AVCodecID codec_id) { const AVCodec *res; @@ -81,6 +83,7 @@ static const FFCodec *AVCodecInitialize(enum AVCodecID codec_id) error("Failed to find decoder"); return ffcodec(res); } +#endif static int subtitle_handler(AVCodecContext *avctx, AVFrame *unused, int *got_sub_ptr, const AVPacket *avpkt) -- 2.49.0 _______________________________________________ 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". ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 2/4] tools/target_dec_fuzzer: suppress Wunused-function 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 2/4] tools/target_dec_fuzzer: suppress Wunused-function Kacper Michajłow @ 2025-06-07 12:30 ` Michael Niedermayer 0 siblings, 0 replies; 8+ messages in thread From: Michael Niedermayer @ 2025-06-07 12:30 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1.1: Type: text/plain, Size: 467 bytes --] On Fri, Jun 06, 2025 at 07:20:33PM +0200, Kacper Michajłow wrote: > Signed-off-by: Kacper Michajłow <kasper93@gmail.com> > --- > tools/target_dec_fuzzer.c | 3 +++ > 1 file changed, 3 insertions(+) will apply patches 2-4 thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "Nothing to hide" only works if the folks in power share the values of you and everyone you know entirely and always will -- Tom Scott [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ 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". ^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH v2 3/4] tools/target_dem_fuzzer: make fuzz data pointer constant 2025-06-06 17:20 [FFmpeg-devel] [PATCH v2 0/4] Minor fixes and for fuzzing targets Kacper Michajłow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement Kacper Michajłow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 2/4] tools/target_dec_fuzzer: suppress Wunused-function Kacper Michajłow @ 2025-06-06 17:20 ` Kacper Michajłow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 4/4] tools/target_dem_fuzzer: remove unused fuzz_tag Kacper Michajłow 3 siblings, 0 replies; 8+ messages in thread From: Kacper Michajłow @ 2025-06-06 17:20 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Kacper Michajłow Mostly to avoid warnings. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> --- tools/target_dem_fuzzer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c index 8e96fad7f8..19bc1f09c1 100644 --- a/tools/target_dem_fuzzer.c +++ b/tools/target_dem_fuzzer.c @@ -29,7 +29,7 @@ typedef struct IOContext { int64_t pos; int64_t filesize; - uint8_t *fuzz; + const uint8_t *fuzz; int fuzz_size; } IOContext; -- 2.49.0 _______________________________________________ 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". ^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH v2 4/4] tools/target_dem_fuzzer: remove unused fuzz_tag 2025-06-06 17:20 [FFmpeg-devel] [PATCH v2 0/4] Minor fixes and for fuzzing targets Kacper Michajłow ` (2 preceding siblings ...) 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 3/4] tools/target_dem_fuzzer: make fuzz data pointer constant Kacper Michajłow @ 2025-06-06 17:20 ` Kacper Michajłow 3 siblings, 0 replies; 8+ messages in thread From: Kacper Michajłow @ 2025-06-06 17:20 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Kacper Michajłow Signed-off-by: Kacper Michajłow <kasper93@gmail.com> --- tools/target_dem_fuzzer.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c index 19bc1f09c1..e169438ceb 100644 --- a/tools/target_dem_fuzzer.c +++ b/tools/target_dem_fuzzer.c @@ -98,10 +98,7 @@ static int64_t io_seek(void *opaque, int64_t offset, int whence) const uint32_t maxiteration = 8096; const int maxblocks= 50000; -static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL; - int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - const uint64_t fuzz_tag = FUZZ_TAG; uint32_t it = 0; AVFormatContext *avfmt = avformat_alloc_context(); AVPacket *pkt; -- 2.49.0 _______________________________________________ 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". ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-06-07 13:46 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-06-06 17:20 [FFmpeg-devel] [PATCH v2 0/4] Minor fixes and for fuzzing targets Kacper Michajłow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement Kacper Michajłow 2025-06-06 21:49 ` Michael Niedermayer 2025-06-07 13:46 ` Kacper Michajlow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 2/4] tools/target_dec_fuzzer: suppress Wunused-function Kacper Michajłow 2025-06-07 12:30 ` Michael Niedermayer 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 3/4] tools/target_dem_fuzzer: make fuzz data pointer constant Kacper Michajłow 2025-06-06 17:20 ` [FFmpeg-devel] [PATCH v2 4/4] tools/target_dem_fuzzer: remove unused fuzz_tag Kacper Michajłow
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