[FFmpeg-cvslog] fftools/ffmpeg: do not fail on AVERROR(EAGAIN) from choose_output()
ffmpeg | branch: master | Anton Khirnov | Tue Sep 5 11:04:31 2023 +0200| [ced62a0c010f74a713fa7f93c115e2284e22f96c] | committer: Anton Khirnov fftools/ffmpeg: do not fail on AVERROR(EAGAIN) from choose_output() This is not an error condition, but would be treated like one if the program terminates on the next transcode loop iteration because of a signal or keyboard input. Fixes #10504 Tested-by: https://github.com/0Ky > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ced62a0c010f74a713fa7f93c115e2284e22f96c --- fftools/ffmpeg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index f1c5f40caf..fd2ce1c2d0 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1196,6 +1196,7 @@ static int transcode(int *err_rate_exceeded) if (ret == AVERROR(EAGAIN)) { reset_eagain(); av_usleep(1); +ret = 0; continue; } else if (ret < 0) { av_log(NULL, AV_LOG_VERBOSE, "No more output streams to write to, finishing.\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat: Inline raw_codec_id where known
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 11 15:34:42 2023 +0200| [830b5cc35ef0a28992a4d9fe90a1ccf612be45fa] | committer: Andreas Rheinhardt avformat: Inline raw_codec_id where known Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=830b5cc35ef0a28992a4d9fe90a1ccf612be45fa --- libavformat/aacdec.c | 2 +- libavformat/adxdec.c | 2 +- libavformat/dfpwmdec.c | 2 +- libavformat/gsmdec.c | 2 +- libavformat/loasdec.c | 2 +- libavformat/serdec.c | 2 +- libavformat/wsddec.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c index 41c9a36239..4da98a6884 100644 --- a/libavformat/aacdec.c +++ b/libavformat/aacdec.c @@ -113,7 +113,7 @@ static int adts_aac_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->codec_id = s->iformat->raw_codec_id; +st->codecpar->codec_id = AV_CODEC_ID_AAC; ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW; ff_id3v1_read(s); diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index d808adbf3b..b6bd3303a7 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -120,7 +120,7 @@ static int adx_read_header(AVFormatContext *s) par->ch_layout.nb_channels = channels; par->codec_type = AVMEDIA_TYPE_AUDIO; -par->codec_id= s->iformat->raw_codec_id; +par->codec_id= AV_CODEC_ID_ADPCM_ADX; par->bit_rate= (int64_t)par->sample_rate * par->ch_layout.nb_channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, par->sample_rate); diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c index 685b95148c..b92b00f13a 100644 --- a/libavformat/dfpwmdec.c +++ b/libavformat/dfpwmdec.c @@ -50,7 +50,7 @@ static int dfpwm_read_header(AVFormatContext *s) par = st->codecpar; par->codec_type = AVMEDIA_TYPE_AUDIO; -par->codec_id= s->iformat->raw_codec_id; +par->codec_id= AV_CODEC_ID_DFPWM; par->sample_rate = s1->sample_rate; #if FF_API_OLD_CHANNEL_LAYOUT if (s1->ch_layout.nb_channels) { diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c index 09dc0e0fb3..7150daa510 100644 --- a/libavformat/gsmdec.c +++ b/libavformat/gsmdec.c @@ -78,7 +78,7 @@ static int gsm_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->codec_id= s->iformat->raw_codec_id; +st->codecpar->codec_id= AV_CODEC_ID_GSM; st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; st->codecpar->sample_rate = c->sample_rate; st->codecpar->bit_rate= GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES; diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c index e739b6c196..7b8b2ea4bc 100644 --- a/libavformat/loasdec.c +++ b/libavformat/loasdec.c @@ -74,7 +74,7 @@ static int loas_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->codec_id = s->iformat->raw_codec_id; +st->codecpar->codec_id = AV_CODEC_ID_AAC_LATM; ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW; //LCM of all possible AAC sample rates diff --git a/libavformat/serdec.c b/libavformat/serdec.c index 11add35b32..639c899249 100644 --- a/libavformat/serdec.c +++ b/libavformat/serdec.c @@ -80,7 +80,7 @@ static int ser_read_header(AVFormatContext *s) } st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; -st->codecpar->codec_id = s->iformat->raw_codec_id; +st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; avpriv_set_pts_info(st, 64, ser->framerate.den, ser->framerate.num); diff --git a/libavformat/wsddec.c b/libavformat/wsddec.c index 9bee4d51bb..8153d898dd 100644 --- a/libavformat/wsddec.c +++ b/libavformat/wsddec.c @@ -125,7 +125,7 @@ static int wsd_read_header(AVFormatContext *s) av_dict_set(&s->metadata, "playback_time", playback_time, 0); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->codec_id= s->iformat->raw_codec_id; +st->codecpar->codec_id= AV_CODEC_ID_DSD_MSBF; st->codecpar->sample_rate = avio_rb32(pb) / 8; avio_skip(pb, 4); st->codecpar->ch_layout.nb_channels = avio_r8(pb) & 0xF; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/avfilter: Don't report deprecated pkt_pos
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 11 14:33:46 2023 +0200| [d0b03b4182752e7e1198108210e70f8bb5a79547] | committer: Andreas Rheinhardt avfilter/avfilter: Don't report deprecated pkt_pos Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d0b03b4182752e7e1198108210e70f8bb5a79547 --- libavfilter/avfilter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 23bf8685e9..ab7782862a 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -49,10 +49,10 @@ static void tlog_ref(void *ctx, AVFrame *ref, int end) { #ifdef TRACE ff_tlog(ctx, -"ref[%p buf:%p data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64, +"ref[%p buf:%p data:%p linesize[%d, %d, %d, %d] pts:%"PRId64, ref, ref->buf, ref->data[0], ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3], -ref->pts, ref->pkt_pos); +ref->pts); if (ref->width) { ff_tlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c", ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/libaribb24,ttmlenc, avutil/tx: Remove redundant init of AVBPrint
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 11 16:08:05 2023 +0200| [c1714a483fa9a3b35b8e391c7a29c4393736d294] | committer: Andreas Rheinhardt avcodec/libaribb24,ttmlenc, avutil/tx: Remove redundant init of AVBPrint An AVBPrint is initialized via av_bprint_init() (or av_bprint_init_for_buffer()) which expects uninitialized AVBPrints; it is therefore not necessary to zero them before the actual initialization. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c1714a483fa9a3b35b8e391c7a29c4393736d294 --- libavcodec/libaribb24.c | 2 +- libavcodec/ttmlenc.c| 2 +- libavutil/tx.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/libaribb24.c b/libavcodec/libaribb24.c index 8032536b22..551be89ffd 100644 --- a/libavcodec/libaribb24.c +++ b/libavcodec/libaribb24.c @@ -227,7 +227,7 @@ static int libaribb24_handle_regions(AVCodecContext *avctx, AVSubtitle *sub) Libaribb24Context *b24 = avctx->priv_data; const arib_buf_region_t *region = arib_decoder_get_regions(b24->decoder); unsigned int profile_font_size = get_profile_font_size(avctx); -AVBPrint buf = { 0 }; +AVBPrint buf; int ret = 0; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); diff --git a/libavcodec/ttmlenc.c b/libavcodec/ttmlenc.c index fb05c38968..6a2ab23cab 100644 --- a/libavcodec/ttmlenc.c +++ b/libavcodec/ttmlenc.c @@ -45,7 +45,7 @@ typedef struct { static void ttml_text_cb(void *priv, const char *text, int len) { TTMLContext *s = priv; -AVBPrint cur_line = { 0 }; +AVBPrint cur_line; AVBPrint *buffer = &s->buffer; av_bprint_init(&cur_line, len, AV_BPRINT_SIZE_UNLIMITED); diff --git a/libavutil/tx.c b/libavutil/tx.c index 24b2015b44..d6740071b9 100644 --- a/libavutil/tx.c +++ b/libavutil/tx.c @@ -595,7 +595,7 @@ static void print_type(AVBPrint *bp, enum AVTXType type) static void print_cd_info(const FFTXCodelet *cd, int prio, int len, int print_prio) { -AVBPrint bp = { 0 }; +AVBPrint bp; av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprintf(&bp, "%s - type: ", cd->name); @@ -718,7 +718,7 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, int codelet_list_idx = codelet_list_num; int nb_cd_matches = 0; #if !CONFIG_SMALL -AVBPrint bp = { 0 }; +AVBPrint bp; #endif /* We still accept functions marked with SLOW, even if the CPU is ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/libaribb24: Use FF_CODEC_CAP_INIT_CLEANUP
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 11 17:02:15 2023 +0200| [038b992256bc331d55d1962b71bb39ef4d33e6ee] | committer: Andreas Rheinhardt avcodec/libaribb24: Use FF_CODEC_CAP_INIT_CLEANUP libaribb24_close() does the same as the fail path in libaribb24_init(). Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=038b992256bc331d55d1962b71bb39ef4d33e6ee --- libavcodec/libaribb24.c | 29 + 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/libavcodec/libaribb24.c b/libavcodec/libaribb24.c index 551be89ffd..29479e375d 100644 --- a/libavcodec/libaribb24.c +++ b/libavcodec/libaribb24.c @@ -147,12 +147,12 @@ static int libaribb24_init(AVCodecContext *avctx) { Libaribb24Context *b24 = avctx->priv_data; void(* arib_dec_init)(arib_decoder_t* decoder) = NULL; -int ret_code = AVERROR_EXTERNAL; +int ret; int profile = avctx->profile; if (!(b24->lib_instance = arib_instance_new(avctx))) { av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24!\n"); -goto init_fail; +return AVERROR_EXTERNAL; } if (b24->aribb24_base_path) { @@ -165,11 +165,11 @@ static int libaribb24_init(AVCodecContext *avctx) if (!(b24->parser = arib_get_parser(b24->lib_instance))) { av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24 PES parser!\n"); -goto init_fail; +return AVERROR_EXTERNAL; } if (!(b24->decoder = arib_get_decoder(b24->lib_instance))) { av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24 decoder!\n"); -goto init_fail; +return AVERROR_EXTERNAL; } if (profile == AV_PROFILE_UNKNOWN) @@ -184,27 +184,16 @@ static int libaribb24_init(AVCodecContext *avctx) break; default: av_log(avctx, AV_LOG_ERROR, "Unknown or unsupported profile set!\n"); -ret_code = AVERROR(EINVAL); -goto init_fail; +return AVERROR(EINVAL); } arib_dec_init(b24->decoder); -if (libaribb24_generate_ass_header(avctx) < 0) { -ret_code = AVERROR(ENOMEM); -goto init_fail; -} +ret = libaribb24_generate_ass_header(avctx); +if (ret < 0) +return ret; return 0; - -init_fail: -if (b24->decoder) -arib_finalize_decoder(b24->decoder); - -if (b24->lib_instance) -arib_instance_destroy(b24->lib_instance); - -return ret_code; } static int libaribb24_close(AVCodecContext *avctx) @@ -410,7 +399,7 @@ const FFCodec ff_libaribb24_decoder = { .p.id = AV_CODEC_ID_ARIB_CAPTION, .p.priv_class = &aribb24_class, .p.wrapper_name = "libaribb24", -.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, +.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_NOT_INIT_THREADSAFE, .priv_data_size = sizeof(Libaribb24Context), .init = libaribb24_init, .close = libaribb24_close, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vmixdec: add support for custom first byte
ffmpeg | branch: master | Paul B Mahol | Thu Sep 14 14:45:22 2023 +0200| [00a837c70ca2056fbd81ca4af41692e34ef79b69] | committer: Paul B Mahol avcodec/vmixdec: add support for custom first byte > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00a837c70ca2056fbd81ca4af41692e34ef79b69 --- libavcodec/vmixdec.c | 36 +++- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/libavcodec/vmixdec.c b/libavcodec/vmixdec.c index 149bb0083d..61f97c1bb4 100644 --- a/libavcodec/vmixdec.c +++ b/libavcodec/vmixdec.c @@ -23,7 +23,6 @@ #include #include -#include "libavutil/avassert.h" #include "libavutil/intreadwrite.h" #include "libavutil/mem_internal.h" @@ -45,6 +44,7 @@ typedef struct SliceContext { typedef struct VMIXContext { int nb_slices; +int lshift; int16_t factors[64]; uint8_t scan[64]; @@ -55,9 +55,22 @@ typedef struct VMIXContext { IDCTDSPContext idsp; } VMIXContext; -static const uint8_t quality[25] = { - 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, -18, 20, 22, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, +static const uint8_t quality[256] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 64, 56, 52, 48, 44, +12, 36, 32, 28, 24, 22, 20, 18, 16, 14, 12, 10, 8, 7, 6, 5, + 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; static const uint8_t quant[64] = { @@ -108,6 +121,7 @@ static int decode_dcac(AVCodecContext *avctx, const uint8_t *scan = s->scan; const int add = plane ? 0 : 1024; int i, dc_v = 0, ac_v = 0, dc = 0; +const int lshift = s->lshift; for (int y = 0; y < 2; y++) { for (int x = 0; x < width; x += 8) { @@ -139,7 +153,7 @@ static int decode_dcac(AVCodecContext *avctx, ac_run = get_ue_golomb_long(ac_gb); } -block[0] = dc + add; +block[0] = (dc << lshift) + add; s->idsp.idct_put(dst + x, linesize, block); } @@ -213,18 +227,22 @@ static int decode_frame(AVCodecContext *avctx, AVPacket *avpkt) { VMIXContext *s = avctx->priv_data; -unsigned offset = 3, q; +unsigned offset, q; int ret; if (avpkt->size <= 7) return AVERROR_INVALIDDATA; -if (avpkt->data[0] != 0x01) +s->lshift = 0; +offset = 2 + avpkt->data[0]; +if (offset == 5) +s->lshift = avpkt->data[1]; +else if (offset != 3) return AVERROR_INVALIDDATA; -q = av_clip(99 - av_clip(avpkt->data[1], 0, 99), 0, FF_ARRAY_ELEMS(quality) - 1); +q = quality[avpkt->data[offset - 2]]; for (int n = 0; n < 64; n++) -s->factors[n] = quant[n] * quality[q]; +s->factors[n] = quant[n] * q; s->nb_slices = (avctx->height + 15) / 16; av_fast_mallocz(&s->slices, &s->slices_size, s->nb_slices * sizeof(*s->slices)); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/jpegxl_anim_dec: Check that size fits within argument
ffmpeg | branch: master | Michael Niedermayer | Sun Sep 10 02:28:05 2023 +0200| [d2e8974699a9e35cc1a926bf74a972300d629cd5] | committer: Michael Niedermayer avformat/jpegxl_anim_dec: Check that size fits within argument Fixes: out of array access Fixes: 61991/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5524679648215040 Fixes: 62181/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5504964305485824 Fixes: 62214/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-4782972823535616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2e8974699a9e35cc1a926bf74a972300d629cd5 --- libavformat/jpegxl_anim_dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c index fc95a1781f..54cd6e4e9d 100644 --- a/libavformat/jpegxl_anim_dec.c +++ b/libavformat/jpegxl_anim_dec.c @@ -152,6 +152,8 @@ static int jpegxl_anim_read_packet(AVFormatContext *s, AVPacket *pkt) size = avio_size(pb); if (size < 0) return size; +if (size > INT_MAX) +return AVERROR(EDOM); if (size == 0) size = 4096; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/jpegxl_parser: Check for ctx->skip overflow
ffmpeg | branch: master | Michael Niedermayer | Sun Sep 10 02:37:47 2023 +0200| [ca09d8a0dcd82e3128e62463231296aaf63ae6f7] | committer: Michael Niedermayer avcodec/jpegxl_parser: Check for ctx->skip overflow Fixes: out of array access Fixes: 62113/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5025082076168192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca09d8a0dcd82e3128e62463231296aaf63ae6f7 --- libavcodec/jpegxl_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c index 4010bc713a..6656ed35c5 100644 --- a/libavcodec/jpegxl_parser.c +++ b/libavcodec/jpegxl_parser.c @@ -1326,7 +1326,7 @@ static int skip_boxes(JXLParseContext *ctx, const uint8_t *buf, int buf_size) if (!size) return AVERROR_INVALIDDATA; /* invalid ISOBMFF size */ -if (size <= head_size + 4) +if (size <= head_size + 4 || size > INT_MAX - ctx->skip) return AVERROR_INVALIDDATA; ctx->skip += size; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/jpeg2000dec: jpeg2000 has its own lowres option
ffmpeg | branch: master | Michael Niedermayer | Sat Jun 10 01:11:48 2023 +0200| [c012d1f2bb8735f2b17ce88cd8181d2ffc989b02] | committer: Michael Niedermayer avcodec/jpeg2000dec: jpeg2000 has its own lowres option jpeg2000 overrides the global lowres variable with a lowres field called reduction_factor ffmpeg -lowres X causes the reduction_factor to be set ffplay -lowres X causes both lowres and the reduction_factor to be set ossfuss sets only lowres only the ffmpeg variant works. This patch tries to make the other 2 work. Alternative we could just error out if things are inconsistent. More complex restructuring should be limited to the master branch to keep this reasonably easy to backport Fixes: out of array access Fixes: 59672/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c012d1f2bb8735f2b17ce88cd8181d2ffc989b02 --- libavcodec/jpeg2000dec.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 7d1a222f71..eda959e558 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -308,7 +308,7 @@ static int get_siz(Jpeg2000DecoderContext *s) dimy = FFMAX(dimy, ff_jpeg2000_ceildiv(o_dimy, s->cdy[i])); } -ret = ff_set_dimensions(s->avctx, dimx, dimy); +ret = ff_set_dimensions(s->avctx, dimx << s->avctx->lowres, dimy << s->avctx->lowres); if (ret < 0) return ret; @@ -2426,6 +2426,14 @@ static av_cold int jpeg2000_decode_init(AVCodecContext *avctx) { Jpeg2000DecoderContext *s = avctx->priv_data; +if (avctx->lowres) +av_log(avctx, AV_LOG_WARNING, "lowres is overriden by reduction_factor but set anyway\n"); +if (!s->reduction_factor && avctx->lowres < JPEG2000_MAX_RESLEVELS) { +s->reduction_factor = avctx->lowres; +} +if (avctx->lowres != s->reduction_factor && avctx->lowres) +return AVERROR(EINVAL); + ff_jpeg2000dsp_init(&s->dsp); ff_jpeg2000_init_tier1_luts(); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
ffmpeg | branch: master | Michael Niedermayer | Tue Jun 20 00:13:43 2023 +0200| [90647a9249aee8c0ef6c0bced3558ada9643f5b6] | committer: Michael Niedermayer avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Fixes: left shift of negative value -1 Fixes: 59889/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HUFFYUV_fuzzer-5472742275940352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90647a9249aee8c0ef6c0bced3558ada9643f5b6 --- libavcodec/huffyuvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 0b7f91dd0a..ce6d4d4c59 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -757,7 +757,7 @@ static void decode_plane_bitstream(HYuvDecContext *s, int width, int plane) } } if( width&1 && get_bits_left(&s->gb)>0 ) { -int dst = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2; +int dst = (unsigned)get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2; s->temp16[0][width-1] = dst + get_bits(&s->gb, 2); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/bonk: Fix integer overflow in predictor_calc_error()
ffmpeg | branch: master | Michael Niedermayer | Sat Jun 3 02:00:51 2023 +0200| [2b25a5168e562676b299ef0f5a086e046833de4c] | committer: Michael Niedermayer avcodec/bonk: Fix integer overflow in predictor_calc_error() Fixes: signed integer overflow: -2147483300 - 12285 cannot be represented in type 'int' Fixes: 59462/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5714298807386112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b25a5168e562676b299ef0f5a086e046833de4c --- libavcodec/bonk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c index fbea91c750..6cd6a0af61 100644 --- a/libavcodec/bonk.c +++ b/libavcodec/bonk.c @@ -277,7 +277,7 @@ static int predictor_calc_error(int *k, int *state, int order, int error) for (i = order-2; i >= 0; i--, k_ptr--, state_ptr--) { unsigned k_value = *k_ptr, state_value = *state_ptr; -x -= shift_down(k_value * (unsigned)state_value, LATTICE_SHIFT); +x -= (unsigned) shift_down(k_value * (unsigned)state_value, LATTICE_SHIFT); state_ptr[1] = state_value + shift_down(k_value * x, LATTICE_SHIFT); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/hwcontext_vulkan: Deduplicate code
ffmpeg | branch: master | Andreas Rheinhardt | Thu Sep 14 22:30:29 2023 +0200| [677635cd04cb0f9c5a9319c1f6109959438eafe0] | committer: Andreas Rheinhardt avutil/hwcontext_vulkan: Deduplicate code Reviewed-by: Lynne Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=677635cd04cb0f9c5a9319c1f6109959438eafe0 --- libavutil/hwcontext_vulkan.c | 26 +- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index d1c2d69b7b..0c846fde38 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -2407,31 +2407,7 @@ static int vulkan_transfer_get_formats(AVHWFramesContext *hwfc, #if CONFIG_LIBDRM static void vulkan_unmap_from_drm(AVHWFramesContext *hwfc, HWMapDescriptor *hwmap) { -AVVkFrame *f = hwmap->priv; -AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; -VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; -FFVulkanFunctions *vk = &p->vkctx.vkfn; -const int nb_images = ff_vk_count_images(f); - -VkSemaphoreWaitInfo wait_info = { -.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, -.flags = 0x0, -.pSemaphores= f->sem, -.pValues= f->sem_value, -.semaphoreCount = nb_images, -}; - -vk->WaitSemaphores(hwctx->act_dev, &wait_info, UINT64_MAX); - -vulkan_free_internal(f); - -for (int i = 0; i < nb_images; i++) { -vk->DestroyImage(hwctx->act_dev, f->img[i], hwctx->alloc); -vk->FreeMemory(hwctx->act_dev, f->mem[i], hwctx->alloc); -vk->DestroySemaphore(hwctx->act_dev, f->sem[i], hwctx->alloc); -} - -av_free(f); +vulkan_frame_free(hwfc, hwmap->priv); } static const struct { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/hwcontext_vulkan: Remove redundant resetting
ffmpeg | branch: master | Andreas Rheinhardt | Thu Sep 14 22:02:57 2023 +0200| [a6bd2ee7594c8625d4fd3b56e2d7c67b23c36580] | committer: Andreas Rheinhardt avutil/hwcontext_vulkan: Remove redundant resetting vulkan_free_internal() already resets the AVVkFrame.internal pointer. Reviewed-by: Lynne Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6bd2ee7594c8625d4fd3b56e2d7c67b23c36580 --- libavutil/hwcontext_vulkan.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 711a32a0ac..c783080567 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -3065,7 +3065,6 @@ static int vulkan_transfer_data_from_cuda(AVHWFramesContext *hwfc, fail: CHECK_CU(cu->cuCtxPopCurrent(&dummy)); vulkan_free_internal(dst_f); -dst_f->internal = NULL; av_buffer_unref(&dst->buf[0]); return err; } @@ -3642,7 +3641,6 @@ static int vulkan_transfer_data_to_cuda(AVHWFramesContext *hwfc, AVFrame *dst, fail: CHECK_CU(cu->cuCtxPopCurrent(&dummy)); vulkan_free_internal(dst_f); -dst_f->internal = NULL; av_buffer_unref(&dst->buf[0]); return err; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/hwcontext_vulkan: Cosmetics
ffmpeg | branch: master | Andreas Rheinhardt | Thu Sep 14 22:40:13 2023 +0200| [dfac782b13fc607f7b18067635b07bbcabc4db8f] | committer: Andreas Rheinhardt avutil/hwcontext_vulkan: Cosmetics The alignment in vulkan_unmap_from_drm() (formerly the clone of vulkan_frame_free()) is nicer than the in vulkan_frame_free(), let's preserve it. Reviewed-by: Lynne Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dfac782b13fc607f7b18067635b07bbcabc4db8f --- libavutil/hwcontext_vulkan.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 0c846fde38..c676f4fc57 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1786,9 +1786,10 @@ static void vulkan_frame_free(AVHWFramesContext *hwfc, AVVkFrame *f) int nb_images = ff_vk_count_images(f); VkSemaphoreWaitInfo sem_wait = { -.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, -.pSemaphores = f->sem, -.pValues = f->sem_value, +.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, +.flags = 0x0, +.pSemaphores= f->sem, +.pValues= f->sem_value, .semaphoreCount = nb_images, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/hwcontext_vulkan: Improve type-safety
ffmpeg | branch: master | Andreas Rheinhardt | Thu Sep 14 22:16:32 2023 +0200| [47b1c0d0db67273e802c369bd9d061ebcad4b971] | committer: Andreas Rheinhardt avutil/hwcontext_vulkan: Improve type-safety The AVBuffer API uses uint8_t as base type for buffers and therefore its free callbacks need to abide by this. Therefore vulkan_frame_free() used an inappropriate signature which caused casts whenever this function has been called manually. This commit changes this by making vulkan_frame_free() use the proper type and a vulkan_frame_free_cb() that is used as free callback for the AVBuffer API. Reviewed-by: Lynne Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47b1c0d0db67273e802c369bd9d061ebcad4b971 --- libavutil/hwcontext_vulkan.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index c783080567..d1c2d69b7b 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1778,10 +1778,8 @@ static void vulkan_free_internal(AVVkFrame *f) av_freep(&f->internal); } -static void vulkan_frame_free(void *opaque, uint8_t *data) +static void vulkan_frame_free(AVHWFramesContext *hwfc, AVVkFrame *f) { -AVVkFrame *f = (AVVkFrame *)data; -AVHWFramesContext *hwfc = opaque; AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; FFVulkanFunctions *vk = &p->vkctx.vkfn; @@ -1807,6 +1805,11 @@ static void vulkan_frame_free(void *opaque, uint8_t *data) av_free(f); } +static void vulkan_frame_free_cb(void *opaque, uint8_t *data) +{ +vulkan_frame_free(opaque, (AVVkFrame*)data); +} + static int alloc_bind_mem(AVHWFramesContext *hwfc, AVVkFrame *f, void *alloc_pnext, size_t alloc_pnext_stride) { @@ -2087,7 +2090,7 @@ static int create_frame(AVHWFramesContext *hwfc, AVVkFrame **frame, return 0; fail: -vulkan_frame_free(hwfc, (uint8_t *)f); +vulkan_frame_free(hwfc, f); return err; } @@ -2209,14 +2212,14 @@ static AVBufferRef *vulkan_pool_alloc(void *opaque, size_t size) goto fail; avbuf = av_buffer_create((uint8_t *)f, sizeof(AVVkFrame), - vulkan_frame_free, hwfc, 0); + vulkan_frame_free_cb, hwfc, 0); if (!avbuf) goto fail; return avbuf; fail: -vulkan_frame_free(hwfc, (uint8_t *)f); +vulkan_frame_free(hwfc, f); return NULL; } @@ -2357,7 +2360,7 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc) if (err) return err; -vulkan_frame_free(hwfc, (uint8_t *)f); +vulkan_frame_free(hwfc, f); /* If user did not specify a pool, hwfc->pool will be set to the internal one * in hwcontext.c just after this gets called */ @@ -2766,7 +2769,7 @@ static int vulkan_map_from_drm(AVHWFramesContext *hwfc, AVFrame *dst, return 0; fail: -vulkan_frame_free(hwfc->device_ctx->hwctx, (uint8_t *)f); +vulkan_frame_free(hwfc->device_ctx->hwctx, f); dst->data[0] = NULL; return err; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vulkan_decode: Factor creating session params out, fix leak
ffmpeg | branch: master | Andreas Rheinhardt | Fri Sep 15 00:29:58 2023 +0200| [c1b6235d4158b3771e2a2ee7d5754477df7edc59] | committer: Andreas Rheinhardt avcodec/vulkan_decode: Factor creating session params out, fix leak All Vulkan HWAccels share the same boilerplate code for creating session params and this includes a common bug: In case actually creating the video session parameters fails, the buffer destined to hold them leaks; in case of HEVC this is also true if get_data_set_buf() fails. This commit factors this code out and fixes the leak. Reviewed-by: Lynne Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c1b6235d4158b3771e2a2ee7d5754477df7edc59 --- libavcodec/vulkan_av1.c| 28 libavcodec/vulkan_decode.c | 31 ++- libavcodec/vulkan_decode.h | 5 +++-- libavcodec/vulkan_h264.c | 28 libavcodec/vulkan_hevc.c | 27 +++ 5 files changed, 44 insertions(+), 75 deletions(-) diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c index adaebb2818..b1373722ef 100644 --- a/libavcodec/vulkan_av1.c +++ b/libavcodec/vulkan_av1.c @@ -104,12 +104,9 @@ static int vk_av1_fill_pict(AVCodecContext *avctx, const AV1Frame **ref_src, static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf) { -VkResult ret; - const AV1DecContext *s = avctx->priv_data; FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data; FFVulkanDecodeShared *ctx = (FFVulkanDecodeShared *)dec->shared_ref->data; -FFVulkanFunctions *vk = &ctx->s.vkfn; const AV1RawSequenceHeader *seq = s->raw_seq; @@ -118,10 +115,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf) VkVideoDecodeAV1SessionParametersCreateInfoMESA av1_params; VkVideoSessionParametersCreateInfoKHR session_params_create; -AVBufferRef *tmp; -VkVideoSessionParametersKHR *par = av_malloc(sizeof(*par)); -if (!par) -return AVERROR(ENOMEM); +int err; av1_sequence_header = (StdVideoAV1MESASequenceHeader) { .flags = (StdVideoAV1MESASequenceHeaderFlags) { @@ -189,26 +183,12 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf) .videoSessionParametersTemplate = NULL, }; -/* Create session parameters */ -ret = vk->CreateVideoSessionParametersKHR(ctx->s.hwctx->act_dev, &session_params_create, - ctx->s.hwctx->alloc, par); -if (ret != VK_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "Unable to create Vulkan video session parameters: %s!\n", - ff_vk_ret2str(ret)); -return AVERROR_EXTERNAL; -} - -tmp = av_buffer_create((uint8_t *)par, sizeof(*par), ff_vk_decode_free_params, - ctx, 0); -if (!tmp) { -ff_vk_decode_free_params(ctx, (uint8_t *)par); -return AVERROR(ENOMEM); -} +err = ff_vk_decode_create_params(buf, avctx, ctx, &session_params_create); +if (err < 0) +return err; av_log(avctx, AV_LOG_DEBUG, "Created frame parameters\n"); -*buf = tmp; - return 0; } diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 3986330c81..534a76edda 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -1057,7 +1057,7 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) return err; } -void ff_vk_decode_free_params(void *opaque, uint8_t *data) +static void vk_decode_free_params(void *opaque, uint8_t *data) { FFVulkanDecodeShared *ctx = opaque; FFVulkanFunctions *vk = &ctx->s.vkfn; @@ -1067,6 +1067,35 @@ void ff_vk_decode_free_params(void *opaque, uint8_t *data) av_free(par); } +int ff_vk_decode_create_params(AVBufferRef **par_ref, void *logctx, FFVulkanDecodeShared *ctx, + const VkVideoSessionParametersCreateInfoKHR *session_params_create) +{ +VkVideoSessionParametersKHR *par = av_malloc(sizeof(*par)); +const FFVulkanFunctions *vk = &ctx->s.vkfn; +VkResult ret; + +if (!par) +return AVERROR(ENOMEM); + +/* Create session parameters */ +ret = vk->CreateVideoSessionParametersKHR(ctx->s.hwctx->act_dev, session_params_create, + ctx->s.hwctx->alloc, par); +if (ret != VK_SUCCESS) { +av_log(logctx, AV_LOG_ERROR, "Unable to create Vulkan video session parameters: %s!\n", + ff_vk_ret2str(ret)); +av_free(par); +return AVERROR_EXTERNAL; +} +*par_ref = av_buffer_create((uint8_t *)par, sizeof(*par), +vk_decode_free_params, ctx, 0); +if (!*par_ref) { +vk_decode_free_params(ctx, (uint8_t *)par); +return AVERROR(ENOMEM); +} + +return 0; +} + int ff_vk_decode_uninit(AVCodecContext *avctx) { FF
[FFmpeg-cvslog] avfilter/dnn_filter_common: fix memleak
ffmpeg | branch: master | Zhao Zhili | Sat Sep 2 16:23:52 2023 +0800| [3e24a2776523866378ef16fbec7ca85291ddccd6] | committer: Guo Yejun avfilter/dnn_filter_common: fix memleak Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e24a2776523866378ef16fbec7ca85291ddccd6 --- libavfilter/dnn_filter_common.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/dnn_filter_common.c b/libavfilter/dnn_filter_common.c index d175c91914..3b9182c1d1 100644 --- a/libavfilter/dnn_filter_common.c +++ b/libavfilter/dnn_filter_common.c @@ -159,4 +159,10 @@ void ff_dnn_uninit(DnnContext *ctx) if (ctx->dnn_module) { (ctx->dnn_module->free_model)(&ctx->model); } +if (ctx->model_outputnames) { +for (int i = 0; i < ctx->nb_outputs; i++) +av_free(ctx->model_outputnames[i]); + +av_freep(&ctx->model_outputnames); +} } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/dnn_backend_openvino: reduce indentation in free_model_ov
ffmpeg | branch: master | Zhao Zhili | Sat Sep 2 16:23:54 2023 +0800| [7cb632929614677adf96c75331a4af93b245628c] | committer: Guo Yejun avfilter/dnn_backend_openvino: reduce indentation in free_model_ov No functional changes except ensures model isn't null. Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7cb632929614677adf96c75331a4af93b245628c --- libavfilter/dnn/dnn_backend_openvino.c | 89 ++ 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 951f179b7c..85db4ecd35 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -463,58 +463,61 @@ static void infer_completion_callback(void *args) static void dnn_free_model_ov(DNNModel **model) { -if (*model){ -OVModel *ov_model = (*model)->model; -while (ff_safe_queue_size(ov_model->request_queue) != 0) { -OVRequestItem *item = ff_safe_queue_pop_front(ov_model->request_queue); -if (item && item->infer_request) { +OVModel *ov_model; + +if (!model || !*model) +return; + +ov_model = (*model)->model; +while (ff_safe_queue_size(ov_model->request_queue) != 0) { +OVRequestItem *item = ff_safe_queue_pop_front(ov_model->request_queue); +if (item && item->infer_request) { #if HAVE_OPENVINO2 -ov_infer_request_free(item->infer_request); +ov_infer_request_free(item->infer_request); #else -ie_infer_request_free(&item->infer_request); +ie_infer_request_free(&item->infer_request); #endif -} -av_freep(&item->lltasks); -av_freep(&item); } -ff_safe_queue_destroy(ov_model->request_queue); +av_freep(&item->lltasks); +av_freep(&item); +} +ff_safe_queue_destroy(ov_model->request_queue); -while (ff_queue_size(ov_model->lltask_queue) != 0) { -LastLevelTaskItem *item = ff_queue_pop_front(ov_model->lltask_queue); -av_freep(&item); -} -ff_queue_destroy(ov_model->lltask_queue); +while (ff_queue_size(ov_model->lltask_queue) != 0) { +LastLevelTaskItem *item = ff_queue_pop_front(ov_model->lltask_queue); +av_freep(&item); +} +ff_queue_destroy(ov_model->lltask_queue); -while (ff_queue_size(ov_model->task_queue) != 0) { -TaskItem *item = ff_queue_pop_front(ov_model->task_queue); -av_frame_free(&item->in_frame); -av_frame_free(&item->out_frame); -av_freep(&item); -} -ff_queue_destroy(ov_model->task_queue); +while (ff_queue_size(ov_model->task_queue) != 0) { +TaskItem *item = ff_queue_pop_front(ov_model->task_queue); +av_frame_free(&item->in_frame); +av_frame_free(&item->out_frame); +av_freep(&item); +} +ff_queue_destroy(ov_model->task_queue); #if HAVE_OPENVINO2 -if (ov_model->preprocess) -ov_preprocess_prepostprocessor_free(ov_model->preprocess); -if (ov_model->compiled_model) -ov_compiled_model_free(ov_model->compiled_model); -if (ov_model->ov_model) -ov_model_free(ov_model->ov_model); -if (ov_model->core) -ov_core_free(ov_model->core); +if (ov_model->preprocess) +ov_preprocess_prepostprocessor_free(ov_model->preprocess); +if (ov_model->compiled_model) +ov_compiled_model_free(ov_model->compiled_model); +if (ov_model->ov_model) +ov_model_free(ov_model->ov_model); +if (ov_model->core) +ov_core_free(ov_model->core); #else -if (ov_model->exe_network) -ie_exec_network_free(&ov_model->exe_network); -if (ov_model->network) -ie_network_free(&ov_model->network); -if (ov_model->core) -ie_core_free(&ov_model->core); -av_free(ov_model->all_output_names); -av_free(ov_model->all_input_names); +if (ov_model->exe_network) +ie_exec_network_free(&ov_model->exe_network); +if (ov_model->network) +ie_network_free(&ov_model->network); +if (ov_model->core) +ie_core_free(&ov_model->core); +av_free(ov_model->all_output_names); +av_free(ov_model->all_input_names); #endif -av_opt_free(&ov_model->ctx); -av_freep(&ov_model); -av_freep(model); -} +av_opt_free(&ov_model->ctx); +av_freep(&ov_model); +av_freep(model); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/dnn_backend_openvino: fix use uninitialized values
ffmpeg | branch: master | Zhao Zhili | Sat Sep 2 16:23:55 2023 +0800| [e0880ef8cb5f92d1c2acb951477d04cb782a6705] | committer: Guo Yejun avfilter/dnn_backend_openvino: fix use uninitialized values Error handling was broken since neither `ret` nor `task` has being initialized on error path. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e0880ef8cb5f92d1c2acb951477d04cb782a6705 --- libavfilter/dnn/dnn_backend_openvino.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 85db4ecd35..7150bf0886 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -1090,37 +1090,37 @@ static int get_output_ov(void *model, const char *input_name, int input_width, i status = ov_partial_shape_create(4, dims, &partial_shape); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed create partial shape.\n"); -goto err; +return ov2_map_error(status, NULL); } status = ov_const_port_get_shape(ov_model->input_port, &input_shape); input_shape.dims[2] = input_height; input_shape.dims[3] = input_width; if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed create shape for model input resize.\n"); -goto err; +return ov2_map_error(status, NULL); } status = ov_shape_to_partial_shape(input_shape, &partial_shape); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed create partial shape for model input resize.\n"); -goto err; +return ov2_map_error(status, NULL); } status = ov_model_reshape_single_input(ov_model->ov_model, partial_shape); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to reszie model input.\n"); -goto err; +return ov2_map_error(status, NULL); } } else { avpriv_report_missing_feature(ctx, "Do not support dynamic model."); -goto err; +return AVERROR(ENOTSUP); } } status = ov_model_const_output_by_name(ov_model->ov_model, output_name, &ov_model->output_port); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get output port.\n"); -goto err; +return ov2_map_error(status, NULL); } if (!ov_model->compiled_model) { #else ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/dnn_backend_openvino: fix multiple memleaks
ffmpeg | branch: master | Zhao Zhili | Sat Sep 2 16:23:53 2023 +0800| [5369548f2e55f7c90969c038f4066a2924168d6d] | committer: Guo Yejun avfilter/dnn_backend_openvino: fix multiple memleaks Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5369548f2e55f7c90969c038f4066a2924168d6d --- libavfilter/dnn/dnn_backend_openvino.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 4922833b07..951f179b7c 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -68,12 +68,12 @@ typedef struct OVModel{ ie_core_t *core; ie_network_t *network; ie_executable_network_t *exe_network; +const char *all_input_names; +const char *all_output_names; #endif SafeQueue *request_queue; // holds OVRequestItem Queue *task_queue; // holds TaskItem Queue *lltask_queue; // holds LastLevelTaskItem -const char *all_input_names; -const char *all_output_names; } OVModel; // one request for one call to openvino @@ -508,7 +508,10 @@ static void dnn_free_model_ov(DNNModel **model) ie_network_free(&ov_model->network); if (ov_model->core) ie_core_free(&ov_model->core); +av_free(ov_model->all_output_names); +av_free(ov_model->all_input_names); #endif +av_opt_free(&ov_model->ctx); av_freep(&ov_model); av_freep(model); } @@ -1255,6 +1258,7 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f goto err; } APPEND_STRING(ov_model->all_input_names, node_name) +ie_network_name_free(&node_name); } status = ie_network_get_outputs_number(ov_model->network, &node_count); if (status != OK) { @@ -1268,6 +1272,7 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f goto err; } APPEND_STRING(ov_model->all_output_names, node_name) +ie_network_name_free(&node_name); } #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/dnn_backend_openvino: fix leak or ov_core_t on error path
ffmpeg | branch: master | Zhao Zhili | Sat Sep 2 16:23:56 2023 +0800| [d2c5c3b7ef7d202fd428c66ceab89e9e9f474f02] | committer: Guo Yejun avfilter/dnn_backend_openvino: fix leak or ov_core_t on error path > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2c5c3b7ef7d202fd428c66ceab89e9e9f474f02 --- libavfilter/dnn/dnn_backend_openvino.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 7150bf0886..b3910adfc3 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -1213,6 +1213,7 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f if (status != OK) { goto err; } +ov_model->core = core; status = ov_core_read_model(core, model_filename, NULL, &ovmodel); if (status != OK) { @@ -1228,7 +1229,6 @@ static DNNModel *dnn_load_model_ov(const char *model_filename, DNNFunctionType f goto err; } ov_model->ov_model = ovmodel; -ov_model->core = core; #else ov_model->all_input_names = NULL; ov_model->all_output_names = NULL; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/dnn_backend_openvino: fix leak of ov_shape_t
ffmpeg | branch: master | Zhao Zhili | Sat Sep 2 16:23:57 2023 +0800| [37123100d29ee934188b4007d75751e3c0fa2eba] | committer: Guo Yejun avfilter/dnn_backend_openvino: fix leak of ov_shape_t > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37123100d29ee934188b4007d75751e3c0fa2eba --- libavfilter/dnn/dnn_backend_openvino.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index b3910adfc3..f9944211da 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -225,6 +225,7 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) status = ov_port_get_element_type(ov_model->input_port, &precision); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get input port data type.\n"); +ov_shape_free(&input_shape); return ov2_map_error(status, NULL); } } else { @@ -236,8 +237,10 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) input.channels = dims[1]; input.dt = precision_to_datatype(precision); input.data = av_malloc(input.height * input.width * input.channels * get_datatype_size(input.dt)); -if (!input.data) +if (!input.data) { +ov_shape_free(&input_shape); return AVERROR(ENOMEM); +} input_data_ptr = input.data; #else status = ie_infer_request_get_blob(request->infer_request, task->input_name, &input_blob); @@ -300,6 +303,7 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) } #if HAVE_OPENVINO2 status = ov_tensor_create_from_host_ptr(precision, input_shape, input.data, &tensor); +ov_shape_free(&input_shape); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to create tensor from host prt.\n"); return ov2_map_error(status, NULL); @@ -362,12 +366,14 @@ static void infer_completion_callback(void *args) status = ov_port_get_element_type(ov_model->output_port, &precision); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get output port data type.\n"); +ov_shape_free(&output_shape); return; } output.channels = dims[1]; output.height = dims[2]; output.width= dims[3]; av_assert0(request->lltask_count <= dims[0]); +ov_shape_free(&output_shape); #else IEStatusCode status; dimensions_t dims; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/dnn_backend_openvino: fix input_port/output_port leaks
ffmpeg | branch: master | Zhao Zhili | Sat Sep 2 16:23:58 2023 +0800| [791b88fcb49805df593d6d08803568ace3d2a017] | committer: Guo Yejun avfilter/dnn_backend_openvino: fix input_port/output_port leaks > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=791b88fcb49805df593d6d08803568ace3d2a017 --- libavfilter/dnn/dnn_backend_openvino.c | 4 1 file changed, 4 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index f9944211da..5de27719b2 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -503,6 +503,10 @@ static void dnn_free_model_ov(DNNModel **model) } ff_queue_destroy(ov_model->task_queue); #if HAVE_OPENVINO2 +if (ov_model->input_port) +ov_output_const_port_free(ov_model->input_port); +if (ov_model->output_port) +ov_output_const_port_free(ov_model->output_port); if (ov_model->preprocess) ov_preprocess_prepostprocessor_free(ov_model->preprocess); if (ov_model->compiled_model) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/dnn_backend_openvino: fix wild pointer on error path
ffmpeg | branch: master | Zhao Zhili | Sat Sep 2 16:23:59 2023 +0800| [4f4dc0a1a29d3689ba8e73a08c13d4f2e152aad1] | committer: Guo Yejun avfilter/dnn_backend_openvino: fix wild pointer on error path When ov_model_const_input_by_name/ov_model_const_output_by_name failed, input_port/output_port can be wild pointer. Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f4dc0a1a29d3689ba8e73a08c13d4f2e152aad1 --- libavfilter/dnn/dnn_backend_openvino.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 5de27719b2..ded156289b 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -210,7 +210,10 @@ static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request) #if HAVE_OPENVINO2 if (!ov_model_is_dynamic(ov_model->ov_model)) { -ov_output_const_port_free(ov_model->input_port); +if (ov_model->input_port) { +ov_output_const_port_free(ov_model->input_port); +ov_model->input_port = NULL; +} status = ov_model_const_input_by_name(ov_model->ov_model, task->input_name, &ov_model->input_port); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get input port shape.\n"); @@ -621,8 +624,10 @@ static int init_model_ov(OVModel *ov_model, const char *input_name, const char * ov_model_free(tmp_ov_model); //update output_port -if (ov_model->output_port) +if (ov_model->output_port) { ov_output_const_port_free(ov_model->output_port); +ov_model->output_port = NULL; +} status = ov_model_const_output_by_name(ov_model->ov_model, output_name, &ov_model->output_port); if (status != OK) { av_log(ctx, AV_LOG_ERROR, "Failed to get output port.\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".