[FFmpeg-devel] [PATCH] avcodec/decode: use avcodec_get_hw_config()
Fixes libavcodec/decode.c:1035:61: runtime error: member access within null pointer of type 'const struct AVCodecHWConfigInternal'. This can happen when hwaccel fails to initialize and hw_configs[i] is NULL. Signed-off-by: Kacper Michajłow --- libavcodec/decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 791940648d..ced4ff3421 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1032,7 +1032,7 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *avctx, AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)avctx->hw_device_ctx->data; for (i = 0;; i++) { -config = &ffcodec(avctx->codec)->hw_configs[i]->public; +config = avcodec_get_hw_config(avctx->codec, i); if (!config) break; if (!(config->methods & -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/vp9mvs: fix misaligned access when clearing VP9mv
Fixes runtime error: member access within misaligned address for type 'av_alias64', which requires 8 byte alignment. VP9mv is aligned to 4 bytes, so instead doing 8 bytes clear, let's do 2 times 4 bytes. Signed-off-by: Kacper Michajłow --- libavcodec/vp9mvs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vp9mvs.c b/libavcodec/vp9mvs.c index b706d1660f..790cf629a6 100644 --- a/libavcodec/vp9mvs.c +++ b/libavcodec/vp9mvs.c @@ -294,7 +294,8 @@ void ff_vp9_fill_mv(VP9TileData *td, VP9mv *mv, int mode, int sb) VP9Block *b = td->b; if (mode == ZEROMV) { -AV_ZERO64(mv); +AV_ZERO32(&mv[0]); +AV_ZERO32(&mv[1]); } else { int hp; -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/nuv: return early if header id fails to read
Fixes use of uninitialized value in memcmp below, reported by MSAN. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavformat/nuv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 507a73b0fe..49915ecf16 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -165,7 +165,9 @@ static int nuv_header(AVFormatContext *s) int is_mythtv, width, height, v_packs, a_packs, ret; AVStream *vst = NULL, *ast = NULL; -avio_read(pb, id_string, 12); +if ((ret = ffio_read_size(pb, id_string, 12)) < 0) +return ret; + is_mythtv = !memcmp(id_string, "MythTVVideo", 12); avio_skip(pb, 5); // version string avio_skip(pb, 3); // padding -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/jpegxl_parser: check remaining data buffer size
Fixes use of uninitialized value, reported by MSAN. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavcodec/jpegxl_parser.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c index 8c45e1a1b7..8371d78a45 100644 --- a/libavcodec/jpegxl_parser.c +++ b/libavcodec/jpegxl_parser.c @@ -504,9 +504,14 @@ static int read_dist_clustering(GetBitContext *gb, JXLEntropyDecoder *dec, JXLDi return 0; } +if (get_bits_left(gb) <= 0) +return AVERROR_BUFFER_TOO_SMALL; + if (get_bits1(gb)) { /* simple clustering */ -uint32_t nbits = get_bits(gb, 2); +int nbits = get_bits(gb, 2); +if (get_bits_left(gb) < nbits * bundle->num_dist) +return AVERROR_BUFFER_TOO_SMALL; for (int i = 0; i < bundle->num_dist; i++) bundle->cluster_map[i] = get_bitsz(gb, nbits); } else { -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/4] avcodec/jpegxl_parser: ensure input padding is zeroed
Fixes use of uninitialized value, reported by MSAN. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavcodec/jpegxl_parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c index 8c45e1a1b7..f833f844c4 100644 --- a/libavcodec/jpegxl_parser.c +++ b/libavcodec/jpegxl_parser.c @@ -1419,6 +1419,7 @@ static int try_parse(AVCodecParserContext *s, AVCodecContext *avctx, JXLParseCon } cs_buffer = ctx->cs_buffer; cs_buflen = FFMIN(sizeof(ctx->cs_buffer) - AV_INPUT_BUFFER_PADDING_SIZE, ctx->copied); +memset(ctx->cs_buffer + cs_buflen, 0, AV_INPUT_BUFFER_PADDING_SIZE); } else { cs_buffer = buf; cs_buflen = buf_size; -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/4] avcodec/parser: ensure input padding is zeroed
Fixes use of uninitialized value, reported by MSAN. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavcodec/parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index af17ee9c15..426cc314fb 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -236,6 +236,7 @@ int ff_combine_frame(ParseContext *pc, int next, } pc->buffer = new_buffer; memcpy(&pc->buffer[pc->index], *buf, *buf_size); +memset(&pc->buffer[pc->index + *buf_size], 0, AV_INPUT_BUFFER_PADDING_SIZE); pc->index += *buf_size; return -1; } -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/4] avformat/img2dec: ensure input padding is zeroed
Fixes use of uninitialized value, reported by MSAN. Specifically in jpegxl parser. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavformat/img2dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index ba52353074..c667d8574c 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -549,6 +549,8 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) } } +memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); + if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) { if (ret[0] < 0) { res = ret[0]; -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/4] avformat/jpegxl_anim_dec: ensure input padding is zeroed
Fixes use of uninitialized value, reported by MSAN. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- 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 ac95d3b961..2338a2e8c0 100644 --- a/libavformat/jpegxl_anim_dec.c +++ b/libavformat/jpegxl_anim_dec.c @@ -124,6 +124,8 @@ static int jpegxl_anim_read_header(AVFormatContext *s) } } +memset(head + headsize, 0, AV_INPUT_BUFFER_PADDING_SIZE); + /* offset in bits of the animation header */ ret = ff_jpegxl_parse_codestream_header(head, headsize, &meta, 0); if (ret < 0 || meta.animation_offset <= 0) -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/[vf_nnedi, vf_estdif]: Check interlaced flag on correct frame
Fixes regression in vf_nnedi after 24dc6d386c6f7edb8f6945319f53a7f0b1642bb8 and vf_estdif while at it. Signed-off-by: Kacper Michajłow --- libavfilter/vf_estdif.c | 2 +- libavfilter/vf_nnedi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_estdif.c b/libavfilter/vf_estdif.c index 9dda604d3c..900e28ce67 100644 --- a/libavfilter/vf_estdif.c +++ b/libavfilter/vf_estdif.c @@ -500,7 +500,7 @@ static int config_input(AVFilterLink *inlink) return 0; } -if ((s->deint && !in->interlaced_frame) || ctx->is_disabled) { +if ((s->deint && !s->prev->interlaced_frame) || ctx->is_disabled) { s->prev->pts *= 2; ret = ff_filter_frame(ctx->outputs[0], s->prev); s->prev = in; diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c index 6096e88812..686091ac8d 100644 --- a/libavfilter/vf_nnedi.c +++ b/libavfilter/vf_nnedi.c @@ -695,7 +695,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return 0; } -if ((s->deint && !in->interlaced_frame) || ctx->is_disabled) { +if ((s->deint && !s->prev->interlaced_frame) || ctx->is_disabled) { s->prev->pts *= 2; ret = ff_filter_frame(ctx->outputs[0], s->prev); s->prev = in; -- 2.28.0.308.g675a4aaf3b ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavutil/opt: Small changes in example.
Fix const corectness and zero init the struct. This example code would actually crash when initializing string. --- libavutil/opt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/opt.h b/libavutil/opt.h index 9a76a47..9430b98 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -58,7 +58,7 @@ * The following example illustrates an AVOptions-enabled struct: * @code * typedef struct test_struct { - * AVClass *class; + * const AVClass *class; * int int_opt; * char*str_opt; * uint8_t *bin_opt; @@ -96,7 +96,7 @@ * @code * test_struct *alloc_test_struct(void) * { - * test_struct *ret = av_malloc(sizeof(*ret)); + * test_struct *ret = av_mallocz(sizeof(*ret)); * ret->class = &test_class; * av_opt_set_defaults(ret); * return ret; -- 2.9.2.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavformat/rtpdec_asf: zero initialize the AVIOContext struct
This fixes crash in avformat_open_input() when accessing protocol_whitelist field. --- libavformat/rtpdec_asf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 8459a51..e344376 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -101,7 +101,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) { int ret = 0; if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) { -AVIOContext pb; +AVIOContext pb = {}; RTSPState *rt = s->priv_data; AVDictionary *opts = NULL; int len = strlen(p) * 6 / 8; -- 2.9.2.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavformat/rtpdec_asf: zero initialize the AVIOContext struct
This fixes crash in avformat_open_input() when accessing protocol_whitelist field. --- libavformat/rtpdec_asf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 8459a51..2c09fda 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -101,7 +101,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) { int ret = 0; if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) { -AVIOContext pb; +AVIOContext pb = { 0 }; RTSPState *rt = s->priv_data; AVDictionary *opts = NULL; int len = strlen(p) * 6 / 8; -- 2.9.2.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Don't disable SSA Optimizer on MSVC v19.00.24218+.
--- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 398e843..3bfd514 100755 --- a/configure +++ b/configure @@ -6317,9 +6317,9 @@ EOF check_func strtoll || add_cflags -Dstrtoll=_strtoi64 check_func strtoull || add_cflags -Dstrtoull=_strtoui64 # the new SSA optimzer in VS2015 U3 is mis-optimizing some parts of the code -# this flag should be re-checked on newer compiler releases and put under a -# version check once its fixed -check_cflags -d2SSAOptimizer- +# Issue has been fixed in MSVC v19.00.24218. +check_cpp_condition windows.h "_MSC_FULL_VER >= 190024218" || +check_cflags -d2SSAOptimizer- fi for pfx in "" host_; do -- 2.10.0.windows.1.325.ge6089c1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: Fix DEF file post-processing with LTO enabled.
With LTO enabled exported symbol entry looks like: av_audio_convert @3 DATA In order to maintain valid format we need to strip everything after @. This patch fixes linking libraries compiled with MinGW toolchain with LTO enabled. Signed-off-by: Kacper Michajłow --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 7201941c36..3ed7b72cf4 100755 --- a/configure +++ b/configure @@ -4919,12 +4919,12 @@ case $target_os in SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' dlltool="${cross_prefix}dlltool" if check_cmd lib.exe -list; then -SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' +SLIB_EXTRA_CMD=-'sed -e "s/ @[^\r\n]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' if enabled x86_64; then LIBTARGET=x64 fi elif check_cmd $dlltool --version; then -SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)' +SLIB_EXTRA_CMD=-'sed -e "s/ @[^\r\n]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)' fi SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' SLIB_INSTALL_LINKS= -- 2.13.3.windows.1.13.gaf0c2223da ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] rtmpproto: Don't mistake app for playpath.
App is always first in the url path. This commit fixes the case when URL is provides as "rtmp://server[:port]/app" and playpath is declared in AVOption. Signed-off-by: Kacper Michajłow --- libavformat/rtmpproto.c | 33 +++-- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 286e9e8..36dbfcf 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -2594,7 +2594,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) { RTMPContext *rt = s->priv_data; char proto[8], hostname[256], path[1024], auth[100], *fname; -char *old_app, *qmark, fname_buffer[1024]; +char *old_app, *qmark, *n, fname_buffer[1024]; uint8_t buf[2048]; int port; AVDictionary *opts = NULL; @@ -2609,11 +2609,13 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) hostname, sizeof(hostname), &port, path, sizeof(path), s->filename); -if (strchr(path, ' ')) { +n = strchr(path, ' '); +if (n) { av_log(s, AV_LOG_WARNING, "Detected librtmp style URL parameters, these aren't supported " "by the libavformat internal RTMP handler currently enabled. " "See the documentation for the correct way to pass parameters.\n"); +*n = '\0'; // Trim not supported part } if (auth[0]) { @@ -2712,8 +2714,8 @@ reconnect: char *next = *path ? path + 1 : path; char *p = strchr(next, '/'); if (!p) { -fname = next; -rt->app[0] = '\0'; +fname = NULL; +av_strlcpy(rt->app, next, APP_MAX_LENGTH); } else { // make sure we do not mismatch a playpath for an application instance char *c = strchr(p + 1, ':'); @@ -2739,24 +2741,27 @@ reconnect: } if (!rt->playpath) { -int len = strlen(fname); - rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH); if (!rt->playpath) { ret = AVERROR(ENOMEM); goto fail; } -if (!strchr(fname, ':') && len >= 4 && -(!strcmp(fname + len - 4, ".f4v") || - !strcmp(fname + len - 4, ".mp4"))) { -memcpy(rt->playpath, "mp4:", 5); +if (fname) { +int len = strlen(fname); +if (!strchr(fname, ':') && len >= 4 && +(!strcmp(fname + len - 4, ".f4v") || + !strcmp(fname + len - 4, ".mp4"))) { +memcpy(rt->playpath, "mp4:", 5); +} else { +if (len >= 4 && !strcmp(fname + len - 4, ".flv")) +fname[len - 4] = '\0'; +rt->playpath[0] = 0; +} +av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH); } else { -if (len >= 4 && !strcmp(fname + len - 4, ".flv")) -fname[len - 4] = '\0'; -rt->playpath[0] = 0; +rt->playpath[0] = '\0'; } -av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH); } if (!rt->tcurl) { -- 2.1.1.308.gd29e9c8 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] rtmpproto: Don't mistake app for playpath.
2014-10-19 16:40 GMT+02:00 Michael Niedermayer : > > On Sun, Oct 19, 2014 at 02:12:14PM +0200, Kacper Michajłow wrote: > > App is always first in the url path. This commit fixes the case when URL is > > provides as "rtmp://server[:port]/app" and playpath is declared in > > AVOption. > > > > Signed-off-by: Kacper Michajłow > > --- > > libavformat/rtmpproto.c | 33 +++-- > > 1 file changed, 19 insertions(+), 14 deletions(-) > > > > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > > index 286e9e8..36dbfcf 100644 > > --- a/libavformat/rtmpproto.c > > +++ b/libavformat/rtmpproto.c > > @@ -2594,7 +2594,7 @@ static int rtmp_open(URLContext *s, const char *uri, > > int flags) > > { > > RTMPContext *rt = s->priv_data; > > char proto[8], hostname[256], path[1024], auth[100], *fname; > > -char *old_app, *qmark, fname_buffer[1024]; > > +char *old_app, *qmark, *n, fname_buffer[1024]; > > uint8_t buf[2048]; > > int port; > > AVDictionary *opts = NULL; > > @@ -2609,11 +2609,13 @@ static int rtmp_open(URLContext *s, const char > > *uri, int flags) > > hostname, sizeof(hostname), &port, > > path, sizeof(path), s->filename); > > > > -if (strchr(path, ' ')) { > > +n = strchr(path, ' '); > > +if (n) { > > av_log(s, AV_LOG_WARNING, > > "Detected librtmp style URL parameters, these aren't > > supported " > > "by the libavformat internal RTMP handler currently > > enabled. " > > "See the documentation for the correct way to pass > > parameters.\n"); > > +*n = '\0'; // Trim not supported part > > } > > > > if (auth[0]) { > > @@ -2712,8 +2714,8 @@ reconnect: > > char *next = *path ? path + 1 : path; > > char *p = strchr(next, '/'); > > if (!p) { > > -fname = next; > > -rt->app[0] = '\0'; > > +fname = NULL; > > +av_strlcpy(rt->app, next, APP_MAX_LENGTH); > > } else { > > // make sure we do not mismatch a playpath for an application > > instance > > char *c = strchr(p + 1, ':'); > > this breaks urls like: > -rtmp_app myapp -rtmp_live 0 -i rtmp://11.22.33.44/foo Indeed. It is little bizarre to me to use url with playpath, but without app name. It feels inconsistent to have rtmp://server/app/playpath url syntax and allow to cut middle part. I will send a path in a sec which will take this into account and assume that app part is missing when user already provided it. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2] rtmpproto: Don't mistake app for playpath.
For URLs "rtmp://server[:port]/foo" determine what `foo` refers to. If application name has been defined by the user assume that `foo` is a playpath, otherwise assume application name. Signed-off-by: Kacper Michajłow --- libavformat/rtmpproto.c | 39 +-- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 286e9e8..03bf4ca 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -2594,7 +2594,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) { RTMPContext *rt = s->priv_data; char proto[8], hostname[256], path[1024], auth[100], *fname; -char *old_app, *qmark, fname_buffer[1024]; +char *old_app, *qmark, *n, fname_buffer[1024]; uint8_t buf[2048]; int port; AVDictionary *opts = NULL; @@ -2609,11 +2609,13 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) hostname, sizeof(hostname), &port, path, sizeof(path), s->filename); -if (strchr(path, ' ')) { +n = strchr(path, ' '); +if (n) { av_log(s, AV_LOG_WARNING, "Detected librtmp style URL parameters, these aren't supported " "by the libavformat internal RTMP handler currently enabled. " "See the documentation for the correct way to pass parameters.\n"); +*n = '\0'; // Trim not supported part } if (auth[0]) { @@ -2712,8 +2714,14 @@ reconnect: char *next = *path ? path + 1 : path; char *p = strchr(next, '/'); if (!p) { -fname = next; -rt->app[0] = '\0'; +if (old_app) { +// If name of application has been defined by the user, assume that +// playpath is provided in the URL +fname = next; +} else { +fname = NULL; +av_strlcpy(rt->app, next, APP_MAX_LENGTH); +} } else { // make sure we do not mismatch a playpath for an application instance char *c = strchr(p + 1, ':'); @@ -2739,24 +2747,27 @@ reconnect: } if (!rt->playpath) { -int len = strlen(fname); - rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH); if (!rt->playpath) { ret = AVERROR(ENOMEM); goto fail; } -if (!strchr(fname, ':') && len >= 4 && -(!strcmp(fname + len - 4, ".f4v") || - !strcmp(fname + len - 4, ".mp4"))) { -memcpy(rt->playpath, "mp4:", 5); +if (fname) { +int len = strlen(fname); +if (!strchr(fname, ':') && len >= 4 && +(!strcmp(fname + len - 4, ".f4v") || + !strcmp(fname + len - 4, ".mp4"))) { +memcpy(rt->playpath, "mp4:", 5); +} else { +if (len >= 4 && !strcmp(fname + len - 4, ".flv")) +fname[len - 4] = '\0'; +rt->playpath[0] = 0; +} +av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH); } else { -if (len >= 4 && !strcmp(fname + len - 4, ".flv")) -fname[len - 4] = '\0'; -rt->playpath[0] = 0; +rt->playpath[0] = '\0'; } -av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH); } if (!rt->tcurl) { -- 2.1.1.308.gd29e9c8 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] avcodec/libaribb24: change new lines to \n in ASS header
Fixes remaining \r\n is ASS header after 57c545090d. --- libavcodec/libaribb24.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/libaribb24.c b/libavcodec/libaribb24.c index 009c995ded..0e4fa9935c 100644 --- a/libavcodec/libaribb24.c +++ b/libavcodec/libaribb24.c @@ -96,13 +96,13 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx) font_size = get_profile_font_size(avctx); avctx->subtitle_header = av_asprintf( - "[Script Info]\r\n" - "; Script generated by FFmpeg/Lavc%s\r\n" - "ScriptType: v4.00+\r\n" - "PlayResX: %d\r\n" - "PlayResY: %d\r\n" - "\r\n" - "[V4+ Styles]\r\n" + "[Script Info]\n" + "; Script generated by FFmpeg/Lavc%s\n" + "ScriptType: v4.00+\n" + "PlayResX: %d\n" + "PlayResY: %d\n" + "\n" + "[V4+ Styles]\n" /* ASSv4 header */ "Format: Name, " @@ -113,7 +113,7 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx) "Spacing, Angle, " "BorderStyle, Outline, Shadow, " "Alignment, MarginL, MarginR, MarginV, " - "Encoding\r\n" + "Encoding\n" "Style: " "Default," /* Name */ @@ -124,11 +124,11 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx) "0,0," /* Spacing, Angle */ "%d,1,0," /* BorderStyle, Outline, Shadow */ "%d,10,10,10," /* Alignment, Margin[LRV] */ - "0\r\n"/* Encoding */ + "0\n" /* Encoding */ - "\r\n" - "[Events]\r\n" - "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n", + "\n" + "[Events]\n" + "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n", !(avctx->flags & AV_CODEC_FLAG_BITEXACT) ? AV_STRINGIFY(LIBAVCODEC_VERSION) : "", plane_width, plane_height, ASS_DEFAULT_FONT, font_size, ASS_DEFAULT_COLOR, -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avcodec/libaribcaption: change new lines to \n in ASS header
Fixes remaining \r\n is ASS header after 57c545090d. --- libavcodec/libaribcaption.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c index 0b67d41772..46a2a591c5 100644 --- a/libavcodec/libaribcaption.c +++ b/libavcodec/libaribcaption.c @@ -522,14 +522,14 @@ static int set_ass_header(ARIBCaptionContext *ctx) av_freep(&avctx->subtitle_header); avctx->subtitle_header = av_asprintf( -"[Script Info]\r\n" -"ScriptType: v4.00+\r\n" -"PlayResX: %d\r\n" -"PlayResY: %d\r\n" -"WrapStyle: 2\r\n" /* 2: no word wrapping */ -"\r\n" - -"[V4+ Styles]\r\n" +"[Script Info]\n" +"ScriptType: v4.00+\n" +"PlayResX: %d\n" +"PlayResY: %d\n" +"WrapStyle: 2\n"/* 2: no word wrapping */ +"\n" + +"[V4+ Styles]\n" "Format: Name, " "Fontname, Fontsize, " "PrimaryColour, SecondaryColour, OutlineColour, BackColour, " @@ -538,7 +538,7 @@ static int set_ass_header(ARIBCaptionContext *ctx) "Spacing, Angle, " "BorderStyle, Outline, Shadow, " "Alignment, MarginL, MarginR, MarginV, " - "Encoding\r\n" + "Encoding\n" "Style: " "Default," /* Name */ @@ -549,11 +549,11 @@ static int set_ass_header(ARIBCaptionContext *ctx) "0,0," /* Spacing, Angle */ "%d,%d,%d,"/* BorderStyle, Outline, Shadow */ "%d,10,10,10," /* Alignment, Margin[LRV] */ - "0\r\n"/* Encoding */ - "\r\n" + "0\n" /* Encoding */ + "\n" - "[Events]\r\n" - "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n", + "[Events]\n" + "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n", ctx->plane_width, ctx->plane_height, font_name, ctx->font_size, ASS_DEFAULT_COLOR, ASS_DEFAULT_COLOR, -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] avcodec/libzvbi-teletextdec: change new lines to \n in ASS header
Fixes remaining \r\n is ASS header after 57c545090d. Fixes AVERROR_BUG error during init as this decoder expected `\r\n` in default ASS header. strstr(..., "\r\n[Events]\r\n") failed after changes in 57c545090d. Fixes: 57c545090d --- libavcodec/libzvbi-teletextdec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c index 68ffe1f76c..e02ecb8b3a 100644 --- a/libavcodec/libzvbi-teletextdec.c +++ b/libavcodec/libzvbi-teletextdec.c @@ -91,7 +91,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx) if (ret < 0) return ret; -event_pos = strstr(avctx->subtitle_header, "\r\n[Events]\r\n"); +event_pos = strstr(avctx->subtitle_header, "\n[Events]\n"); if (!event_pos) return AVERROR_BUG; @@ -106,7 +106,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx) "0,0," /* Spacing, Angle */ "3,0.1,0," /* BorderStyle, Outline, Shadow */ "5,1,1,1," /* Alignment, Margin[LRV] */ -"0\r\n"/* Encoding */ +"0\n" /* Encoding */ "Style: " "Subtitle,"/* Name */ "Monospace,16,"/* Font{name,size} */ @@ -116,7 +116,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx) "0,0," /* Spacing, Angle */ "1,1,1," /* BorderStyle, Outline, Shadow */ "8,48,48,20," /* Alignment, Margin[LRV] */ -"0\r\n"/* Encoding */ +"0\n" /* Encoding */ , event_pos); if (!new_header) -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v5] avcodec/h2645_sei: validate Mastering Display Colour Volume SEI values
As we can read in ST 2086: Values outside the specified ranges of luminance and chromaticity values are not reserved by SMPTE, and can be used for purposes outside the scope of this standard. This is further acknowledged by ITU-T H.264 and ITU-T H.265. Which says that values out of range are unknown or unspecified or specified by other means not specified in this Specification. Signed-off-by: Kacper Michajłow --- libavcodec/h2645_sei.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c index 933975f076..96a22e7cf6 100644 --- a/libavcodec/h2645_sei.c +++ b/libavcodec/h2645_sei.c @@ -587,38 +587,61 @@ static int h2645_sei_to_side_data(AVCodecContext *avctx, H2645SEI *sei, return ret; if (metadata) { +metadata->has_luminance = 1; +metadata->has_primaries = 1; + for (i = 0; i < 3; i++) { const int j = mapping[i]; metadata->display_primaries[i][0].num = sei->mastering_display.display_primaries[j][0]; metadata->display_primaries[i][0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][0] >= 5 && + sei->mastering_display.display_primaries[j][0] <= 37000; + metadata->display_primaries[i][1].num = sei->mastering_display.display_primaries[j][1]; metadata->display_primaries[i][1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][1] >= 5 && + sei->mastering_display.display_primaries[j][1] <= 42000; } metadata->white_point[0].num = sei->mastering_display.white_point[0]; metadata->white_point[0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[0] >= 5 && + sei->mastering_display.white_point[0] <= 37000; + metadata->white_point[1].num = sei->mastering_display.white_point[1]; metadata->white_point[1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[1] >= 5 && + sei->mastering_display.white_point[1] <= 42000; metadata->max_luminance.num = sei->mastering_display.max_luminance; metadata->max_luminance.den = luma_den; +metadata->has_luminance &= sei->mastering_display.max_luminance >= 5 && + sei->mastering_display.max_luminance <= 1; + metadata->min_luminance.num = sei->mastering_display.min_luminance; metadata->min_luminance.den = luma_den; -metadata->has_luminance = 1; -metadata->has_primaries = 1; - -av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); -av_log(avctx, AV_LOG_DEBUG, - "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", - av_q2d(metadata->display_primaries[0][0]), - av_q2d(metadata->display_primaries[0][1]), - av_q2d(metadata->display_primaries[1][0]), - av_q2d(metadata->display_primaries[1][1]), - av_q2d(metadata->display_primaries[2][0]), - av_q2d(metadata->display_primaries[2][1]), - av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); -av_log(avctx, AV_LOG_DEBUG, - "min_luminance=%f, max_luminance=%f\n", - av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance)); +metadata->has_luminance &= sei->mastering_display.min_luminance >= 1 && + sei->mastering_display.min_luminance <= 5 && + sei->mastering_display.min_luminance < + sei->mastering_display.max_luminance; + +if (metadata->has_luminance || metadata->has_primaries) +av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); +if (metadata->has_primaries) { +av_log(avctx, AV_LOG_DEBUG, + "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", + av_q2d(metadata->display_primaries[0][0]), + av_q2d(metadata->display_primaries[0][1]), +
[FFmpeg-devel] [PATCH] avformat/data_uri: Fix base64 decode buffer size calculation
Also reject input if it is too short. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavformat/data_uri.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/data_uri.c b/libavformat/data_uri.c index 3868a19630..f97ecbab37 100644 --- a/libavformat/data_uri.c +++ b/libavformat/data_uri.c @@ -73,11 +73,11 @@ static av_cold int data_open(URLContext *h, const char *uri, int flags) data++; in_size = strlen(data); if (base64) { -size_t out_size = 3 * (in_size / 4) + 1; +size_t out_size = AV_BASE64_DECODE_SIZE(in_size); if (out_size > INT_MAX || !(ddata = av_malloc(out_size))) return AVERROR(ENOMEM); -if ((ret = av_base64_decode(ddata, data, out_size)) < 0) { +if (!out_size || (ret = av_base64_decode(ddata, data, out_size)) < 0) { av_free(ddata); av_log(h, AV_LOG_ERROR, "Invalid base64 in URI\n"); return ret; -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/srtpproto: pass options to nested protocol
This fixes passing options dict. Fixes some timeouts found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavformat/srtpproto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/srtpproto.c b/libavformat/srtpproto.c index 61669e05ad..02cf156327 100644 --- a/libavformat/srtpproto.c +++ b/libavformat/srtpproto.c @@ -61,7 +61,7 @@ static int srtp_close(URLContext *h) return 0; } -static int srtp_open(URLContext *h, const char *uri, int flags) +static int srtp_open(URLContext *h, const char *uri, int flags, AVDictionary **options) { SRTPProtoContext *s = h->priv_data; char hostname[256], buf[1024], path[1024]; @@ -78,7 +78,7 @@ static int srtp_open(URLContext *h, const char *uri, int flags) path, sizeof(path), uri); ff_url_join(buf, sizeof(buf), "rtp", NULL, hostname, rtp_port, "%s", path); if ((ret = ffurl_open_whitelist(&s->rtp_hd, buf, flags, &h->interrupt_callback, -NULL, h->protocol_whitelist, h->protocol_blacklist, h)) < 0) +options, h->protocol_whitelist, h->protocol_blacklist, h)) < 0) goto fail; h->max_packet_size = FFMIN(s->rtp_hd->max_packet_size, @@ -131,7 +131,7 @@ static int srtp_get_multi_file_handle(URLContext *h, int **handles, const URLProtocol ff_srtp_protocol = { .name = "srtp", -.url_open = srtp_open, +.url_open2 = srtp_open, .url_read = srtp_read, .url_write = srtp_write, .url_close = srtp_close, -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/rtpproto: free ip filters on open error
Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavformat/rtpproto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index b1cdf061f0..15d0050936 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -379,6 +379,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags) return 0; fail: +ff_ip_reset_filters(&s->filters); ffurl_closep(&s->rtp_hd); ffurl_closep(&s->rtcp_hd); ffurl_closep(&s->fec_hd); -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/3] avcodec/libaribb24: change new lines to \n in ASS header
Fixes remaining \r\n is ASS header after 57c545090d. Signed-off-by: Kacper Michajłow --- libavcodec/libaribb24.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/libaribb24.c b/libavcodec/libaribb24.c index 009c995ded..0e4fa9935c 100644 --- a/libavcodec/libaribb24.c +++ b/libavcodec/libaribb24.c @@ -96,13 +96,13 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx) font_size = get_profile_font_size(avctx); avctx->subtitle_header = av_asprintf( - "[Script Info]\r\n" - "; Script generated by FFmpeg/Lavc%s\r\n" - "ScriptType: v4.00+\r\n" - "PlayResX: %d\r\n" - "PlayResY: %d\r\n" - "\r\n" - "[V4+ Styles]\r\n" + "[Script Info]\n" + "; Script generated by FFmpeg/Lavc%s\n" + "ScriptType: v4.00+\n" + "PlayResX: %d\n" + "PlayResY: %d\n" + "\n" + "[V4+ Styles]\n" /* ASSv4 header */ "Format: Name, " @@ -113,7 +113,7 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx) "Spacing, Angle, " "BorderStyle, Outline, Shadow, " "Alignment, MarginL, MarginR, MarginV, " - "Encoding\r\n" + "Encoding\n" "Style: " "Default," /* Name */ @@ -124,11 +124,11 @@ static int libaribb24_generate_ass_header(AVCodecContext *avctx) "0,0," /* Spacing, Angle */ "%d,1,0," /* BorderStyle, Outline, Shadow */ "%d,10,10,10," /* Alignment, Margin[LRV] */ - "0\r\n"/* Encoding */ + "0\n" /* Encoding */ - "\r\n" - "[Events]\r\n" - "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n", + "\n" + "[Events]\n" + "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n", !(avctx->flags & AV_CODEC_FLAG_BITEXACT) ? AV_STRINGIFY(LIBAVCODEC_VERSION) : "", plane_width, plane_height, ASS_DEFAULT_FONT, font_size, ASS_DEFAULT_COLOR, -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/3] avcodec/libaribcaption: change new lines to \n in ASS header
Fixes remaining \r\n is ASS header after 57c545090d. Signed-off-by: Kacper Michajłow --- libavcodec/libaribcaption.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c index 0b67d41772..46a2a591c5 100644 --- a/libavcodec/libaribcaption.c +++ b/libavcodec/libaribcaption.c @@ -522,14 +522,14 @@ static int set_ass_header(ARIBCaptionContext *ctx) av_freep(&avctx->subtitle_header); avctx->subtitle_header = av_asprintf( -"[Script Info]\r\n" -"ScriptType: v4.00+\r\n" -"PlayResX: %d\r\n" -"PlayResY: %d\r\n" -"WrapStyle: 2\r\n" /* 2: no word wrapping */ -"\r\n" - -"[V4+ Styles]\r\n" +"[Script Info]\n" +"ScriptType: v4.00+\n" +"PlayResX: %d\n" +"PlayResY: %d\n" +"WrapStyle: 2\n"/* 2: no word wrapping */ +"\n" + +"[V4+ Styles]\n" "Format: Name, " "Fontname, Fontsize, " "PrimaryColour, SecondaryColour, OutlineColour, BackColour, " @@ -538,7 +538,7 @@ static int set_ass_header(ARIBCaptionContext *ctx) "Spacing, Angle, " "BorderStyle, Outline, Shadow, " "Alignment, MarginL, MarginR, MarginV, " - "Encoding\r\n" + "Encoding\n" "Style: " "Default," /* Name */ @@ -549,11 +549,11 @@ static int set_ass_header(ARIBCaptionContext *ctx) "0,0," /* Spacing, Angle */ "%d,%d,%d,"/* BorderStyle, Outline, Shadow */ "%d,10,10,10," /* Alignment, Margin[LRV] */ - "0\r\n"/* Encoding */ - "\r\n" + "0\n" /* Encoding */ + "\n" - "[Events]\r\n" - "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n", + "[Events]\n" + "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n", ctx->plane_width, ctx->plane_height, font_name, ctx->font_size, ASS_DEFAULT_COLOR, ASS_DEFAULT_COLOR, -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/3] avcodec/libzvbi-teletextdec: change new lines to \n in ASS header
Fixes remaining \r\n is ASS header after 57c545090d. Fixes AVERROR_BUG error during init as this decoder expected `\r\n` in default ASS header. strstr(..., "\r\n[Events]\r\n") failed after changes in 57c545090d. Fixes: 57c545090d Signed-off-by: Kacper Michajłow --- libavcodec/libzvbi-teletextdec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c index 68ffe1f76c..e02ecb8b3a 100644 --- a/libavcodec/libzvbi-teletextdec.c +++ b/libavcodec/libzvbi-teletextdec.c @@ -91,7 +91,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx) if (ret < 0) return ret; -event_pos = strstr(avctx->subtitle_header, "\r\n[Events]\r\n"); +event_pos = strstr(avctx->subtitle_header, "\n[Events]\n"); if (!event_pos) return AVERROR_BUG; @@ -106,7 +106,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx) "0,0," /* Spacing, Angle */ "3,0.1,0," /* BorderStyle, Outline, Shadow */ "5,1,1,1," /* Alignment, Margin[LRV] */ -"0\r\n"/* Encoding */ +"0\n" /* Encoding */ "Style: " "Subtitle,"/* Name */ "Monospace,16,"/* Font{name,size} */ @@ -116,7 +116,7 @@ static int my_ass_subtitle_header(AVCodecContext *avctx) "0,0," /* Spacing, Angle */ "1,1,1," /* BorderStyle, Outline, Shadow */ "8,48,48,20," /* Alignment, Margin[LRV] */ -"0\r\n"/* Encoding */ +"0\n" /* Encoding */ , event_pos); if (!new_header) -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avformat/hls: update current segment reference before use
It may be invalidated by the time it is used. Fixes use after free when accessing current segment. Fixes: #10825 Signed-off-by: Kacper Michajłow --- libavformat/hls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index 214a99c7ba..62473a15dd 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -2099,6 +2099,7 @@ static int hls_read_header(AVFormatContext *s) * If encryption scheme is SAMPLE-AES and audio setup information is present in external audio track, * use that information to find the media format, otherwise probe input data */ +seg = current_segment(pls); if (seg && seg->key_type == KEY_SAMPLE_AES && pls->is_id3_timestamped && pls->audio_setup_info.codec_id != AV_CODEC_ID_NONE) { av_assert1(pls->audio_setup_info.codec_id == AV_CODEC_ID_AAC || @@ -2127,6 +2128,7 @@ static int hls_read_header(AVFormatContext *s) av_free(url); } +seg = current_segment(pls); if (seg && seg->key_type == KEY_SAMPLE_AES) { if (strstr(in_fmt->name, "mov")) { char key[33]; @@ -2173,6 +2175,7 @@ static int hls_read_header(AVFormatContext *s) * on us if they want to. */ if (pls->is_id3_timestamped || (pls->n_renditions > 0 && pls->renditions[0]->type == AVMEDIA_TYPE_AUDIO)) { +seg = current_segment(pls); if (seg && seg->key_type == KEY_SAMPLE_AES && pls->audio_setup_info.setup_data_length > 0 && pls->ctx->nb_streams == 1) ret = ff_hls_senc_parse_audio_setup_info(pls->ctx->streams[0], &pls->audio_setup_info); -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/rtsp: Set timeouts also when reading header
Signed-off-by: Kacper Michajłow --- libavformat/rtsp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index b0c61ee00a..4b067ee76b 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -135,6 +135,8 @@ static AVDictionary *map_to_opts(RTSPState *rt) av_dict_set_int(&opts, "pkt_size",rt->pkt_size,0); if (rt->localaddr && rt->localaddr[0]) av_dict_set(&opts, "localaddr", rt->localaddr, 0); +av_dict_set_int(&opts, "listen_timeout", rt->initial_timeout, 0); +av_dict_set_int(&opts, "timeout", rt->stimeout, 0); return opts; } -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/rpl: reject invalid sample rate
Fixes overflow check for bit_rate multiplication few lines below. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavformat/rpl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 09d0b68f74..32a762b60a 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -202,6 +202,8 @@ static int rpl_read_header(AVFormatContext *s) ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ast->codecpar->codec_tag = audio_format; ast->codecpar->sample_rate = read_line_and_int(pb, &error); // audio bitrate +if (ast->codecpar->sample_rate < 0) +return AVERROR_INVALIDDATA; channels = read_line_and_int(pb, &error); // number of audio channels error |= read_line(pb, line, sizeof(line)); ast->codecpar->bits_per_coded_sample = read_int(line, &endptr, &error); // audio bits per sample -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avformat/data_uri: Fix base64 decode buffer size calculation
Signed-off-by: Kacper Michajłow --- libavformat/data_uri.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/data_uri.c b/libavformat/data_uri.c index 3868a19630..5991ad4ed4 100644 --- a/libavformat/data_uri.c +++ b/libavformat/data_uri.c @@ -73,7 +73,7 @@ static av_cold int data_open(URLContext *h, const char *uri, int flags) data++; in_size = strlen(data); if (base64) { -size_t out_size = 3 * (in_size / 4) + 1; +size_t out_size = AV_BASE64_DECODE_SIZE(in_size); if (out_size > INT_MAX || !(ddata = av_malloc(out_size))) return AVERROR(ENOMEM); -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/h2645_sei: validate Mastering Display Colour Volume SEI values
As we can read in ST 2086: Values outside the specified ranges of luminance and chromaticity values are not reserved by SMPTE, and can be used for purposes outside the scope of this standard. This is further acknowledged by ITU-T H.264 and ITU-T H.265. Which says that values out of range are unknown or unspecified or specified by other means not specified in this Specification. Signed-off-by: Kacper Michajłow --- libavcodec/h2645_sei.c | 53 +- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c index cb6be0594b..f3ac8004a9 100644 --- a/libavcodec/h2645_sei.c +++ b/libavcodec/h2645_sei.c @@ -715,38 +715,59 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei, if (!metadata) return AVERROR(ENOMEM); +metadata->has_luminance = 1; +metadata->has_primaries = 1; + for (i = 0; i < 3; i++) { const int j = mapping[i]; metadata->display_primaries[i][0].num = sei->mastering_display.display_primaries[j][0]; metadata->display_primaries[i][0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][0] >= 5 && + sei->mastering_display.display_primaries[j][0] <= 37000; + metadata->display_primaries[i][1].num = sei->mastering_display.display_primaries[j][1]; metadata->display_primaries[i][1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][1] >= 5 && + sei->mastering_display.display_primaries[j][1] <= 42000; } metadata->white_point[0].num = sei->mastering_display.white_point[0]; metadata->white_point[0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[0] >= 5 && + sei->mastering_display.white_point[0] <= 37000; + metadata->white_point[1].num = sei->mastering_display.white_point[1]; metadata->white_point[1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[0] >= 5 && + sei->mastering_display.white_point[0] <= 42000; metadata->max_luminance.num = sei->mastering_display.max_luminance; metadata->max_luminance.den = luma_den; +metadata->has_luminance &= sei->mastering_display.max_luminance >= 5 && + sei->mastering_display.max_luminance <= 1; + metadata->min_luminance.num = sei->mastering_display.min_luminance; metadata->min_luminance.den = luma_den; -metadata->has_luminance = 1; -metadata->has_primaries = 1; - -av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); -av_log(avctx, AV_LOG_DEBUG, - "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", - av_q2d(metadata->display_primaries[0][0]), - av_q2d(metadata->display_primaries[0][1]), - av_q2d(metadata->display_primaries[1][0]), - av_q2d(metadata->display_primaries[1][1]), - av_q2d(metadata->display_primaries[2][0]), - av_q2d(metadata->display_primaries[2][1]), - av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); -av_log(avctx, AV_LOG_DEBUG, - "min_luminance=%f, max_luminance=%f\n", - av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance)); +metadata->has_luminance &= sei->mastering_display.min_luminance >= 1 && + sei->mastering_display.min_luminance <= 5; + +if (metadata->has_luminance || metadata->has_primaries) +av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); +if (metadata->has_primaries) { +av_log(avctx, AV_LOG_DEBUG, + "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", + av_q2d(metadata->display_primaries[0][0]), + av_q2d(metadata->display_primaries[0][1]), + av_q2d(metadata->display_primaries[1][0]), + av_q2d(metadata->display_primaries[1][1]), + av_q2d(metadata->display_primaries[2][0]), + av_q2d(metadata->display_primaries[2][1]), + av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); +} +if (metadata->has_luminance) { +
[FFmpeg-devel] [PATCH v2] avcodec/h2645_sei: validate Mastering Display Colour Volume SEI values
As we can read in ST 2086: Values outside the specified ranges of luminance and chromaticity values are not reserved by SMPTE, and can be used for purposes outside the scope of this standard. This is further acknowledged by ITU-T H.264 and ITU-T H.265. Which says that values out of range are unknown or unspecified or specified by other means not specified in this Specification. Signed-off-by: Kacper Michajłow --- libavcodec/h2645_sei.c | 53 +- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c index cb6be0594b..e3581e8136 100644 --- a/libavcodec/h2645_sei.c +++ b/libavcodec/h2645_sei.c @@ -715,38 +715,59 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei, if (!metadata) return AVERROR(ENOMEM); +metadata->has_luminance = 1; +metadata->has_primaries = 1; + for (i = 0; i < 3; i++) { const int j = mapping[i]; metadata->display_primaries[i][0].num = sei->mastering_display.display_primaries[j][0]; metadata->display_primaries[i][0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][0] >= 5 && + sei->mastering_display.display_primaries[j][0] <= 37000; + metadata->display_primaries[i][1].num = sei->mastering_display.display_primaries[j][1]; metadata->display_primaries[i][1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][1] >= 5 && + sei->mastering_display.display_primaries[j][1] <= 42000; } metadata->white_point[0].num = sei->mastering_display.white_point[0]; metadata->white_point[0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[0] >= 5 && + sei->mastering_display.white_point[0] <= 37000; + metadata->white_point[1].num = sei->mastering_display.white_point[1]; metadata->white_point[1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[1] >= 5 && + sei->mastering_display.white_point[1] <= 42000; metadata->max_luminance.num = sei->mastering_display.max_luminance; metadata->max_luminance.den = luma_den; +metadata->has_luminance &= sei->mastering_display.max_luminance >= 5 && + sei->mastering_display.max_luminance <= 1; + metadata->min_luminance.num = sei->mastering_display.min_luminance; metadata->min_luminance.den = luma_den; -metadata->has_luminance = 1; -metadata->has_primaries = 1; - -av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); -av_log(avctx, AV_LOG_DEBUG, - "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", - av_q2d(metadata->display_primaries[0][0]), - av_q2d(metadata->display_primaries[0][1]), - av_q2d(metadata->display_primaries[1][0]), - av_q2d(metadata->display_primaries[1][1]), - av_q2d(metadata->display_primaries[2][0]), - av_q2d(metadata->display_primaries[2][1]), - av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); -av_log(avctx, AV_LOG_DEBUG, - "min_luminance=%f, max_luminance=%f\n", - av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance)); +metadata->has_luminance &= sei->mastering_display.min_luminance >= 1 && + sei->mastering_display.min_luminance <= 5; + +if (metadata->has_luminance || metadata->has_primaries) +av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); +if (metadata->has_primaries) { +av_log(avctx, AV_LOG_DEBUG, + "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", + av_q2d(metadata->display_primaries[0][0]), + av_q2d(metadata->display_primaries[0][1]), + av_q2d(metadata->display_primaries[1][0]), + av_q2d(metadata->display_primaries[1][1]), + av_q2d(metadata->display_primaries[2][0]), + av_q2d(metadata->display_primaries[2][1]), + av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); +} +if (metadata->has_luminance) { +
[FFmpeg-devel] [PATCH v3] avcodec/h2645_sei: validate Mastering Display Colour Volume SEI values
As we can read in ST 2086: Values outside the specified ranges of luminance and chromaticity values are not reserved by SMPTE, and can be used for purposes outside the scope of this standard. This is further acknowledged by ITU-T H.264 and ITU-T H.265. Which says that values out of range are unknown or unspecified or specified by other means not specified in this Specification. Signed-off-by: Kacper Michajłow --- libavcodec/h2645_sei.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c index cb6be0594b..b5f46e776a 100644 --- a/libavcodec/h2645_sei.c +++ b/libavcodec/h2645_sei.c @@ -715,38 +715,61 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei, if (!metadata) return AVERROR(ENOMEM); +metadata->has_luminance = 1; +metadata->has_primaries = 1; + for (i = 0; i < 3; i++) { const int j = mapping[i]; metadata->display_primaries[i][0].num = sei->mastering_display.display_primaries[j][0]; metadata->display_primaries[i][0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][0] >= 5 && + sei->mastering_display.display_primaries[j][0] <= 37000; + metadata->display_primaries[i][1].num = sei->mastering_display.display_primaries[j][1]; metadata->display_primaries[i][1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][1] >= 5 && + sei->mastering_display.display_primaries[j][1] <= 42000; } metadata->white_point[0].num = sei->mastering_display.white_point[0]; metadata->white_point[0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[0] >= 5 && + sei->mastering_display.white_point[0] <= 37000; + metadata->white_point[1].num = sei->mastering_display.white_point[1]; metadata->white_point[1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[1] >= 5 && + sei->mastering_display.white_point[1] <= 42000; metadata->max_luminance.num = sei->mastering_display.max_luminance; metadata->max_luminance.den = luma_den; +metadata->has_luminance &= sei->mastering_display.max_luminance >= 5 && + sei->mastering_display.max_luminance <= 1; + metadata->min_luminance.num = sei->mastering_display.min_luminance; metadata->min_luminance.den = luma_den; -metadata->has_luminance = 1; -metadata->has_primaries = 1; - -av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); -av_log(avctx, AV_LOG_DEBUG, - "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", - av_q2d(metadata->display_primaries[0][0]), - av_q2d(metadata->display_primaries[0][1]), - av_q2d(metadata->display_primaries[1][0]), - av_q2d(metadata->display_primaries[1][1]), - av_q2d(metadata->display_primaries[2][0]), - av_q2d(metadata->display_primaries[2][1]), - av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); -av_log(avctx, AV_LOG_DEBUG, - "min_luminance=%f, max_luminance=%f\n", - av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance)); +metadata->has_luminance &= sei->mastering_display.min_luminance >= 1 && + sei->mastering_display.min_luminance <= 5 && + sei->mastering_display.min_luminance < + sei->mastering_display.max_luminance; + +if (metadata->has_luminance || metadata->has_primaries) +av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); +if (metadata->has_primaries) { +av_log(avctx, AV_LOG_DEBUG, + "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", + av_q2d(metadata->display_primaries[0][0]), + av_q2d(metadata->display_primaries[0][1]), + av_q2d(metadata->display_primaries[1][0]), + av_q2d(metadata->display_primaries[1][1]), + av_q2d(metadata->display_primaries[2][0]), + av_q2d(metadata-&
[FFmpeg-devel] [PATCH v4] avcodec/h2645_sei: validate Mastering Display Colour Volume SEI values
As we can read in ST 2086: Values outside the specified ranges of luminance and chromaticity values are not reserved by SMPTE, and can be used for purposes outside the scope of this standard. This is further acknowledged by ITU-T H.264 and ITU-T H.265. Which says that values out of range are unknown or unspecified or specified by other means not specified in this Specification. Signed-off-by: Kacper Michajłow --- libavcodec/h2645_sei.c | 55 ++ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c index e60606f43f..ba0eb5059f 100644 --- a/libavcodec/h2645_sei.c +++ b/libavcodec/h2645_sei.c @@ -719,38 +719,61 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei, return ret; if (metadata) { +metadata->has_luminance = 1; +metadata->has_primaries = 1; + for (i = 0; i < 3; i++) { const int j = mapping[i]; metadata->display_primaries[i][0].num = sei->mastering_display.display_primaries[j][0]; metadata->display_primaries[i][0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][0] >= 5 && + sei->mastering_display.display_primaries[j][0] <= 37000; + metadata->display_primaries[i][1].num = sei->mastering_display.display_primaries[j][1]; metadata->display_primaries[i][1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.display_primaries[j][1] >= 5 && + sei->mastering_display.display_primaries[j][1] <= 42000; } metadata->white_point[0].num = sei->mastering_display.white_point[0]; metadata->white_point[0].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[0] >= 5 && + sei->mastering_display.white_point[0] <= 37000; + metadata->white_point[1].num = sei->mastering_display.white_point[1]; metadata->white_point[1].den = chroma_den; +metadata->has_primaries &= sei->mastering_display.white_point[1] >= 5 && + sei->mastering_display.white_point[1] <= 42000; metadata->max_luminance.num = sei->mastering_display.max_luminance; metadata->max_luminance.den = luma_den; +metadata->has_luminance &= sei->mastering_display.max_luminance >= 5 && + sei->mastering_display.max_luminance <= 1; + metadata->min_luminance.num = sei->mastering_display.min_luminance; metadata->min_luminance.den = luma_den; -metadata->has_luminance = 1; -metadata->has_primaries = 1; - -av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); -av_log(avctx, AV_LOG_DEBUG, - "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", - av_q2d(metadata->display_primaries[0][0]), - av_q2d(metadata->display_primaries[0][1]), - av_q2d(metadata->display_primaries[1][0]), - av_q2d(metadata->display_primaries[1][1]), - av_q2d(metadata->display_primaries[2][0]), - av_q2d(metadata->display_primaries[2][1]), - av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); -av_log(avctx, AV_LOG_DEBUG, - "min_luminance=%f, max_luminance=%f\n", - av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance)); +metadata->has_luminance &= sei->mastering_display.min_luminance >= 1 && + sei->mastering_display.min_luminance <= 5 && + sei->mastering_display.min_luminance < + sei->mastering_display.max_luminance; + +if (metadata->has_luminance || metadata->has_primaries) +av_log(avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); +if (metadata->has_primaries) { +av_log(avctx, AV_LOG_DEBUG, + "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", + av_q2d(metadata->display_primaries[0][0]), + av_q2d(metadata->display_primaries[0][1]), + av_q2d(metadata->displ
[FFmpeg-devel] [PATCH] avformat/hls: update current segment reference before use
It may be invalidated by the time it is used. Fixes use after free when accessing current segment. Fixes: #10825 --- libavformat/hls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index f6b44c2e35..94bc6bc064 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -2098,6 +2098,7 @@ static int hls_read_header(AVFormatContext *s) * If encryption scheme is SAMPLE-AES and audio setup information is present in external audio track, * use that information to find the media format, otherwise probe input data */ +seg = current_segment(pls); if (seg && seg->key_type == KEY_SAMPLE_AES && pls->is_id3_timestamped && pls->audio_setup_info.codec_id != AV_CODEC_ID_NONE) { void *iter = NULL; @@ -2124,6 +2125,7 @@ static int hls_read_header(AVFormatContext *s) av_free(url); } +seg = current_segment(pls); if (seg && seg->key_type == KEY_SAMPLE_AES) { if (strstr(in_fmt->name, "mov")) { char key[33]; @@ -2170,6 +2172,7 @@ static int hls_read_header(AVFormatContext *s) * on us if they want to. */ if (pls->is_id3_timestamped || (pls->n_renditions > 0 && pls->renditions[0]->type == AVMEDIA_TYPE_AUDIO)) { +seg = current_segment(pls); if (seg && seg->key_type == KEY_SAMPLE_AES && pls->audio_setup_info.setup_data_length > 0 && pls->ctx->nb_streams == 1) ret = ff_hls_senc_parse_audio_setup_info(pls->ctx->streams[0], &pls->audio_setup_info); -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/3] avcodec/vulkan_decode: fix struct type for h265_profile
Signed-off-by: Kacper Michajłow --- libavcodec/vulkan_decode.c | 2 +- libavcodec/vulkan_decode.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index f20733fb39..04350578f9 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -682,7 +682,7 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx, VkVideoProfileListInfoKHR *profile_list = &prof->profile_list; VkVideoDecodeH264ProfileInfoKHR *h264_profile = &prof->h264_profile; -VkVideoDecodeH264ProfileInfoKHR *h265_profile = &prof->h265_profile; +VkVideoDecodeH265ProfileInfoKHR *h265_profile = &prof->h265_profile; VkVideoDecodeAV1ProfileInfoMESA *av1_profile = &prof->av1_profile; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); diff --git a/libavcodec/vulkan_decode.h b/libavcodec/vulkan_decode.h index 0aaa2e2de0..c50527e5f8 100644 --- a/libavcodec/vulkan_decode.h +++ b/libavcodec/vulkan_decode.h @@ -27,7 +27,7 @@ typedef struct FFVulkanDecodeProfileData { VkVideoDecodeH264ProfileInfoKHR h264_profile; -VkVideoDecodeH264ProfileInfoKHR h265_profile; +VkVideoDecodeH265ProfileInfoKHR h265_profile; VkVideoDecodeAV1ProfileInfoMESA av1_profile; VkVideoDecodeUsageInfoKHR usage; VkVideoProfileInfoKHR profile; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avcodec/vulkan_decode: check specVersion to avoid using incompatible implementations
Fixes: VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07190 VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07191 As a bonus avoids crashing AMD video driver on Windows, which currently doesn't advertise support. Signed-off-by: Kacper Michajłow --- libavcodec/vulkan_decode.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 04350578f9..7607edf52e 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -881,6 +881,11 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR ? " separate_references" : ""); +if (dec_ext[avctx->codec_id]->specVersion > caps->stdHeaderVersion.specVersion || +strncmp(caps->stdHeaderVersion.extensionName, +dec_ext[avctx->codec_id]->extensionName, VK_MAX_EXTENSION_NAME_SIZE)) +return AVERROR(EINVAL); + /* Check if decoding is possible with the given parameters */ if (avctx->width < caps->minCodedExtent.width || avctx->height < caps->minCodedExtent.height || -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] avcodec/vulkan_decode: print also codec header name
Signed-off-by: Kacper Michajłow --- libavcodec/vulkan_decode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 7607edf52e..0d561b7450 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -863,6 +863,9 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ caps->maxDpbSlots); av_log(avctx, AV_LOG_VERBOSE, "Maximum active references: %u\n", caps->maxActiveReferencePictures); +av_log(avctx, AV_LOG_VERBOSE, "Codec header name: '%s' (driver), '%s' (compiled)\n", + caps->stdHeaderVersion.extensionName, + dec_ext[avctx->codec_id]->extensionName); av_log(avctx, AV_LOG_VERBOSE, "Codec header version: %i.%i.%i (driver), %i.%i.%i (compiled)\n", CODEC_VER(caps->stdHeaderVersion.specVersion), CODEC_VER(dec_ext[avctx->codec_id]->specVersion)); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] configure: don't force specific C++ standard library linking
Other C++ standard libraries exist. Also, this is not a proper way to link the standard library anyway. Instead when a C++ dependency is detected, switch to the C++ compiler driver to properly link everything. Signed-off-by: Kacper Michajłow --- configure | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/configure b/configure index bd7f7697c8..90ee6e4f7d 100755 --- a/configure +++ b/configure @@ -3584,11 +3584,9 @@ bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr caca_outdev_deps="libcaca" decklink_deps_any="libdl LoadLibrary" decklink_indev_deps="decklink threads" -decklink_indev_extralibs="-lstdc++" decklink_indev_suggest="libzvbi" decklink_outdev_deps="decklink threads" decklink_outdev_suggest="libklvanc" -decklink_outdev_extralibs="-lstdc++" dshow_indev_deps="IBaseFilter" dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" fbdev_indev_deps="linux_fb_h" @@ -4684,7 +4682,6 @@ msvc_common_flags(){ -march=*) ;; -lz) echo zlib.lib ;; -lx264) echo libx264.lib ;; --lstdc++) ;; -l*) echo ${flag#-l}.lib ;; -LARGEADDRESSAWARE) echo $flag ;; -L*) echo -libpath:${flag#-L} ;; @@ -4984,6 +4981,18 @@ set_ccvars HOSTCC test -n "$cc_type" && enable $cc_type || warn "Unknown C compiler $cc, unable to select optimal CFLAGS" +cxx_deps=( +decklink +libglslang +libgme +libopenmpt +librubberband +libsnappy +) +for l in ${cxx_deps[@]}; do +enabled $l && ld_default=$cxx +done + : ${as_default:=$cc} : ${objcc_default:=$cc} : ${dep_cc_default:=$cc} @@ -6706,12 +6715,12 @@ enabled libfribidi&& require_pkg_config libfribidi fribidi fribidi.h fri enabled libharfbuzz && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \ -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \ --lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm || +-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lm || require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \ -lglslang -lOSDependent -lHLSL -lOGLCompiler \ --lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; } +-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lm; } enabled libgme&& { check_pkg_config libgme libgme gme/gme.h gme_new_emu || - require libgme gme/gme.h gme_new_emu -lgme -lstdc++; } + require libgme gme/gme.h gme_new_emu -lgme; } enabled libgsm&& { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break; done || die "ERROR: libgsm not found"; } @@ -6770,7 +6779,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h && enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version || { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } } -enabled libopenmpt&& require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++" +enabled libopenmpt&& require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create enabled libopenvino && { { check_pkg_config libopenvino openvino openvino/c/openvino.h ov_core_create && enable openvino2; } || { check_pkg_config libopenvino openvino c_api/ie_c_api.h ie_c_api_version || require libopenvino c_api/ie_c_api.h ie_c_api_version -linference_engine_c_api; } } @@ -6789,12 +6798,12 @@ enabled librav1e && require_pkg_config librav1e "rav1e >= 0.5.0" rav1e. en
[FFmpeg-devel] [PATCH 2/2] configure: add libplacebo to the list of C++ dependencies
If libplacebo is statically linked with glslang it requires C++ standard library. Also recently more C++ code has been added to libplacebo. Signed-off-by: Kacper Michajłow --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 90ee6e4f7d..ed714639d1 100755 --- a/configure +++ b/configure @@ -4986,6 +4986,7 @@ cxx_deps=( libglslang libgme libopenmpt +libplacebo librubberband libsnappy ) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] configure: add libplacebo to the list of C++ dependencies
If libplacebo is statically linked with glslang it requires C++ standard library. Also recently more C++ code has been added to libplacebo. Signed-off-by: Kacper Michajłow --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index f3ff48586a..0dbdffb5c1 100755 --- a/configure +++ b/configure @@ -4987,6 +4987,7 @@ cxx_deps=( libglslang libgme libopenmpt +libplacebo librubberband libsnappy ) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/2] configure: don't force specific C++ standard library linking
Other C++ standard libraries exist. Also, this is not a proper way to link the standard library anyway. Instead when a C++ dependency is detected, switch to the C++ compiler driver to properly link everything. Signed-off-by: Kacper Michajłow --- configure | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/configure b/configure index bd7f7697c8..f3ff48586a 100755 --- a/configure +++ b/configure @@ -3584,11 +3584,9 @@ bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr caca_outdev_deps="libcaca" decklink_deps_any="libdl LoadLibrary" decklink_indev_deps="decklink threads" -decklink_indev_extralibs="-lstdc++" decklink_indev_suggest="libzvbi" decklink_outdev_deps="decklink threads" decklink_outdev_suggest="libklvanc" -decklink_outdev_extralibs="-lstdc++" dshow_indev_deps="IBaseFilter" dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" fbdev_indev_deps="linux_fb_h" @@ -4984,6 +4982,18 @@ set_ccvars HOSTCC test -n "$cc_type" && enable $cc_type || warn "Unknown C compiler $cc, unable to select optimal CFLAGS" +cxx_deps=( +decklink +libglslang +libgme +libopenmpt +librubberband +libsnappy +) +for l in ${cxx_deps[@]}; do +enabled $l && ld_default=$cxx +done + : ${as_default:=$cc} : ${objcc_default:=$cc} : ${dep_cc_default:=$cc} @@ -6706,12 +6716,12 @@ enabled libfribidi&& require_pkg_config libfribidi fribidi fribidi.h fri enabled libharfbuzz && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \ -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \ --lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm || +-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lm || require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \ -lglslang -lOSDependent -lHLSL -lOGLCompiler \ --lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; } +-lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lm; } enabled libgme&& { check_pkg_config libgme libgme gme/gme.h gme_new_emu || - require libgme gme/gme.h gme_new_emu -lgme -lstdc++; } + require libgme gme/gme.h gme_new_emu -lgme; } enabled libgsm&& { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break; done || die "ERROR: libgsm not found"; } @@ -6770,7 +6780,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h && enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version || { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } } -enabled libopenmpt&& require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++" +enabled libopenmpt&& require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create enabled libopenvino && { { check_pkg_config libopenvino openvino openvino/c/openvino.h ov_core_create && enable openvino2; } || { check_pkg_config libopenvino openvino c_api/ie_c_api.h ie_c_api_version || require libopenvino c_api/ie_c_api.h ie_c_api_version -linference_engine_c_api; } } @@ -6789,12 +6799,12 @@ enabled librav1e && require_pkg_config librav1e "rav1e >= 0.5.0" rav1e. enabled librist && require_pkg_config librist "librist >= 0.2.7" librist/librist.h rist_receiver_create enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket -enabled librubber
[FFmpeg-devel] [PATCH] configure: use -flto=auto if available
Signed-off-by: Kacper Michajłow --- configure | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 9e51abd0d3..bf5a687239 100755 --- a/configure +++ b/configure @@ -7173,8 +7173,9 @@ check_optflags -fno-signed-zeros if enabled lto; then test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker" -check_cflags -flto -check_ldflags -flto $cpuflags +check_cflags -flto=auto || check_cflags -flto +check_ldflags -flto=auto || check_ldflags -flto +check_ldflags $cpuflags disable inline_asm_direct_symbol_refs fi -- 2.37.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] swscale: add missing opaque parameter after f2de911818
Fixes function prototype mismatch, warning Wlto-type-mismatch. Signed-off-by: Kacper Michajłow --- libswscale/x86/rgb2rgb_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/x86/rgb2rgb_template.c b/libswscale/x86/rgb2rgb_template.c index 4aba25dd51..f6c843e4f2 100644 --- a/libswscale/x86/rgb2rgb_template.c +++ b/libswscale/x86/rgb2rgb_template.c @@ -1823,7 +1823,7 @@ void RENAME(ff_nv12ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int w, - uint32_t *unused2); + uint32_t *unused2, void *opq); static void RENAME(deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride) @@ -1831,7 +1831,7 @@ static void RENAME(deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t int h; for (h = 0; h < height; h++) { -RENAME(ff_nv12ToUV)(dst1, dst2, NULL, src, NULL, width, NULL); +RENAME(ff_nv12ToUV)(dst1, dst2, NULL, src, NULL, width, NULL, NULL); src += srcStride; dst1 += dst1Stride; dst2 += dst2Stride; -- 2.37.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] configure: try to use -flto=thin or -flto=auto if available
Signed-off-by: Kacper Michajłow --- configure | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 9e51abd0d3..a651fdec5a 100755 --- a/configure +++ b/configure @@ -7173,8 +7173,9 @@ check_optflags -fno-signed-zeros if enabled lto; then test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker" -check_cflags -flto -check_ldflags -flto $cpuflags +check_cflags -flto=thin || check_cflags -flto=auto || check_cflags -flto +check_ldflags -flto=thin || check_ldflags -flto=auto || check_ldflags -flto +check_ldflags $cpuflags disable inline_asm_direct_symbol_refs fi -- 2.37.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/vf_scale: validate values before converting to integer
Fixes the conversion of double values to integer, which may be out of the representable range. Also, bail out on overflow check instead of printing an error only. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavfilter/vf_scale.c | 33 +++-- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index ae7356fd7b..66bb81dd1f 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -537,7 +537,6 @@ static int scale_eval_dimensions(AVFilterContext *ctx) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); const AVPixFmtDescriptor *out_desc = av_pix_fmt_desc_get(outlink->format); char *expr; -int eval_w, eval_h; int ret; double res; const AVPixFmtDescriptor *main_desc; @@ -588,26 +587,20 @@ static int scale_eval_dimensions(AVFilterContext *ctx) } res = av_expr_eval(scale->w_pexpr, scale->var_values, NULL); -eval_w = scale->var_values[VAR_OUT_W] = scale->var_values[VAR_OW] = (int) res == 0 ? inlink->w : (int) res; - -res = av_expr_eval(scale->h_pexpr, scale->var_values, NULL); -if (isnan(res)) { -expr = scale->h_expr; +if (isnan(res) || res < INT_MIN || res > INT_MAX) { +expr = scale->w_expr; ret = AVERROR(EINVAL); goto fail; } -eval_h = scale->var_values[VAR_OUT_H] = scale->var_values[VAR_OH] = (int) res == 0 ? inlink->h : (int) res; +scale->w = scale->var_values[VAR_OUT_W] = scale->var_values[VAR_OW] = res == 0 ? inlink->w : res; -res = av_expr_eval(scale->w_pexpr, scale->var_values, NULL); -if (isnan(res)) { -expr = scale->w_expr; +res = av_expr_eval(scale->h_pexpr, scale->var_values, NULL); +if (isnan(res) || res < INT_MIN || res > INT_MAX) { +expr = scale->h_expr; ret = AVERROR(EINVAL); goto fail; } -eval_w = scale->var_values[VAR_OUT_W] = scale->var_values[VAR_OW] = (int) res == 0 ? inlink->w : (int) res; - -scale->w = eval_w; -scale->h = eval_h; +scale->h = scale->var_values[VAR_OUT_H] = scale->var_values[VAR_OH] = res == 0 ? inlink->h : res; return 0; @@ -642,11 +635,15 @@ static int config_props(AVFilterLink *outlink) scale->force_original_aspect_ratio, scale->force_divisible_by); -if (outlink->w > INT_MAX || -outlink->h > INT_MAX || -(outlink->h * inlink->w) > INT_MAX || -(outlink->w * inlink->h) > INT_MAX) +if (outlink->w <= 0 || +outlink->h <= 0 || +outlink->h > INT_MAX / inlink->w || +outlink->w > INT_MAX / inlink->h) +{ av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n"); +ret = AVERROR(EINVAL); +goto fail; +} /* TODO: make algorithm configurable */ -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/wmavoice: use av_clipd for double values
Fixes Clang warning. Signed-off-by: Kacper Michajłow --- libavcodec/wmavoice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 258c71330c..3db73773b7 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -655,7 +655,7 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs_src, lpcs[n] = angle_mul * pwr; /* 70.57 =~ 1/log10(1.0331663) */ -idx = av_clipf((pwr * gain_mul - 0.0295) * 70.570526123, 0, INT_MAX / 2); +idx = av_clipd((pwr * gain_mul - 0.0295) * 70.570526123, 0, INT_MAX / 2); if (idx > 127) { // fall back if index falls outside table range coeffs[n] = wmavoice_energy_table[127] * -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/vpk: fix divide by zero
Can happen after calling avformat_find_stream_info() when the codec fails to open, but return value is 0 and subsequent uses of this context have zero value in channel number. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavformat/vpk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/vpk.c b/libavformat/vpk.c index 001ad33555..aa98ef2dd4 100644 --- a/libavformat/vpk.c +++ b/libavformat/vpk.c @@ -86,6 +86,8 @@ static int vpk_read_packet(AVFormatContext *s, AVPacket *pkt) vpk->current_block++; if (vpk->current_block == vpk->block_count) { +if (par->ch_layout.nb_channels <= 0) +return AVERROR_INVALIDDATA; unsigned size = vpk->last_block_size / par->ch_layout.nb_channels; unsigned skip = (par->block_align - vpk->last_block_size) / par->ch_layout.nb_channels; uint64_t pos = avio_tell(s->pb); -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/mov: ensure required number of bytes is read
Fixes: use-of-uninitialized-value Found by OSS-Fuzz. --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 1052691936..f2d8aee766 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7096,7 +7096,7 @@ static int mov_read_free(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.size < 8) return 0; -ret = avio_read(pb, content, FFMIN(sizeof(content), atom.size)); +ret = ffio_read_size(pb, content, FFMIN(sizeof(content), atom.size)); if (ret < 0) return ret; -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] configure: support MSYS2
2015-01-25 21:36 GMT+01:00 Hendrik Leppkes : > On Sun, Jan 25, 2015 at 7:44 PM, James Almer wrote: > > > On 25/01/15 2:47 PM, Hendrik Leppkes wrote: > > > On Sun, Jan 25, 2015 at 6:43 PM, Michael Niedermayer > > > > wrote: > > > > > >> On Sun, Jan 25, 2015 at 05:02:58PM +0100, Reimar Döffinger wrote: > > >>> On Sun, Jan 25, 2015 at 03:59:12PM +0100, Hendrik Leppkes wrote: > > On Sun, Jan 25, 2015 at 3:26 PM, Hendrik Leppkes < > h.lepp...@gmail.com > > > > > wrote: > > > > > MSYS2 uses a system name of "MSYS_NT-6.3" instead of > > >> "MINGW32_NT-6.3" in > > > MSYS1. > > > > > > > Apparently this isn't quite correct, and you have to start MSYS2 > with > > a > > special batch file that overrides this for you. > > Just running bash.exe or sh.exe from a DOS prompt results in this > and > > >> is > > apparently considered "wrong usage". > > >>> > > >>> I don't really see anything wrong with this, however I'd rather have > > >>> a compiler-based detection. > > >>> I.e. if the compiler define __MINGW32__ set the host to mingw (unless > > >>> set explicitly). > > >> > > >>> This should also address my other annoyance that you have to specify > > >>> --host when it really should be obvious that you are cross-compiling > to > > >>> MINGW for example. > > >> > > >> i dont use "--host*" for my mingw building > > >> just -cc='ccache x86_64-w64-mingw32-gcc' --arch=x86_64 > > --target-os=mingw32 > > >> --cross-prefix=x86_64-w64-mingw32- --target_exec=wine > > >> > > >> the rest i use should not be mingw specific > > >> > > >> > > > I've never had to specify --host things either, the only problem with > > MSYS2 > > > I ran into was that you still need to specify --target-os unless you > use > > > their fancy batch file, and that tripped me up a bit. > > > Never a problem with old MSYS and my own gcc build. > > > > As you said the old MSYS uses "MINGW32" as part of the system name, while > > the > > normal batch file for MSYS2 sets it as "MSYS". > > If you instead use the x86 batch file it will be set as "MINGW32", or > > "MINGW64" > > if you use the x86_64 batch file. > > > > The different batch files exist not just to change the output of uname, > > but also > > to change the PATH environment variable too include either /mingw32 or > > /mingw64 > > respectively. Their package manager offers a complete toolchain and > > precompiled > > libraries, which get installed in one of the two folders above. > > Ideally speaking, if you don't want to use their gcc toolchains, you > should > > install your own in some other folder (/usr/local, /opt, etc) and use the > > normal > > batch file. > > > > configure currently only checks for mingw32 since that's what MSYS sets, > > so it > > needs to be updated to also check for mingw64 and msys, so this patch is > > IMO > > correct but incomplete as its missing the check for the former. > > > > > My problem really is with their choice of default. Apparently (or so I am > told), the MSYS_* string is for building things actually for MSYS itself, > which is imho a bad default. > If I just call sh/bash.exe (like I do in a multitude of my scripts), I > wouldn't want that to be the default value, especially since it breaks with > compat for all sorts of projects (we're not the only project with that > problem) > > I agree that this change of behavior comparing to MSYS1 can be confusing. But I think they made it sane enough. If we set MSYSTEM environmental variable to MINGW32 anywhere before call to sh/bash.exe it will present itself as MINGW32_* and work fine. This doesn't require any tricks just one env variable to be set. Additionally when calling "bash --login" it will alter PATH to include /mingw32 bin dir, but this is optional if we take care about it ourself. As for the path itself I think it is incorrect because we can't consider MSYS and MINGW the same thing. - Kacper ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] hevc : support deinterlacing inside the decoder
2015-02-08 10:48 GMT+01:00 Carl Eugen Hoyos : > Mickaël Raulet insa-rennes.fr> writes: > > > As we can consider, we won't have 4k interlaced > > content, copying a field into a frame should be ok. > > This is what has been done in this implementation. > > Do you have a sample? > I am only interested in testing this. > > Thank you, Carl Eugen > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > If I understand correctly, this should fix this ticket #4141. Sample is included. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec: Fix libdcadec include dir
--- configure | 2 +- libavcodec/libdcadec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index a449bc7..1ef83e3 100755 --- a/configure +++ b/configure @@ -4925,7 +4925,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } enabled libcaca && require_pkg_config caca caca.h caca_create_canvas -enabled libdcadec && require libdcadec dca_context.h dcadec_context_create -ldcadec +enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfdk_aac&& require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c index d060db5..a28b983 100644 --- a/libavcodec/libdcadec.c +++ b/libavcodec/libdcadec.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" -- 2.3.1.167.g7f4ba4b ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/vulkan_decode: Make Vulkan decode less spammy in verbose logs
Drop per frame decode messages to AV_LOG_TRACE level. Signed-off-by: Kacper Michajłow --- libavcodec/vulkan_av1.c | 2 +- libavcodec/vulkan_h264.c | 2 +- libavcodec/vulkan_hevc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c index 9730e4b08d..c7d5a54012 100644 --- a/libavcodec/vulkan_av1.c +++ b/libavcodec/vulkan_av1.c @@ -530,7 +530,7 @@ static int vk_av1_end_frame(AVCodecContext *avctx) rav[i] = ap->ref_src[i]->f; } -av_log(avctx, AV_LOG_VERBOSE, "Decoding frame, %"SIZE_SPECIFIER" bytes, %i tiles\n", +av_log(avctx, AV_LOG_TRACE, "Decoding frame, %"SIZE_SPECIFIER" bytes, %i tiles\n", vp->slices_size, ap->tile_list.nb_tiles); return ff_vk_decode_frame(avctx, pic->f, vp, rav, rvp); diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c index 39c123ddca..c918dbaa13 100644 --- a/libavcodec/vulkan_h264.c +++ b/libavcodec/vulkan_h264.c @@ -529,7 +529,7 @@ static int vk_h264_end_frame(AVCodecContext *avctx) rav[i] = hp->ref_src[i]->f; } -av_log(avctx, AV_LOG_VERBOSE, "Decoding frame, %"SIZE_SPECIFIER" bytes, %i slices\n", +av_log(avctx, AV_LOG_TRACE, "Decoding frame, %"SIZE_SPECIFIER" bytes, %i slices\n", vp->slices_size, hp->h264_pic_info.sliceCount); return ff_vk_decode_frame(avctx, pic->f, vp, rav, rvp); diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c index 033172cbd6..0f6f2e775b 100644 --- a/libavcodec/vulkan_hevc.c +++ b/libavcodec/vulkan_hevc.c @@ -903,7 +903,7 @@ static int vk_hevc_end_frame(AVCodecContext *avctx) rvp[i] = &rfhp->vp; } -av_log(avctx, AV_LOG_VERBOSE, "Decoding frame, %"SIZE_SPECIFIER" bytes, %i slices\n", +av_log(avctx, AV_LOG_TRACE, "Decoding frame, %"SIZE_SPECIFIER" bytes, %i slices\n", vp->slices_size, hp->h265_pic_info.sliceSegmentCount); return ff_vk_decode_frame(avctx, pic->frame, vp, rav, rvp); -- 2.42.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] configure: Fix Microsoft tools detection
LLVM tools print installation path upon execution. If one uses LLVM tools bundled with Microsoft Visual Studio installation, they would be incorrectly detected as Microsoft's ones. Signed-off-by: Kacper Michajłow --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 94f513288a..f27fd067eb 100755 --- a/configure +++ b/configure @@ -4820,9 +4820,9 @@ probe_cc(){ _flags_filter=msvc_flags _ld_lib='lib%.a' _ld_path='-libpath:' -elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then +elif $_cc -nologo- 2>&1 | grep -q 'Microsoft.*Optimizing.*Compiler' || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then _type=msvc -if $_cc -nologo- 2>&1 | grep -q Microsoft; then +if $_cc -nologo- 2>&1 | grep -q 'Microsoft.*Optimizing.*Compiler'; then _ident=$($_cc 2>&1 | head -n1 | tr -d '\r') else _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r') @@ -4927,7 +4927,7 @@ if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then DEPCCFLAGS=$_flags fi -if $ar 2>&1 | grep -q Microsoft; then +if $ar 2>&1 | grep -q 'Microsoft.*Library.*Manager'; then arflags="-nologo" ar_o='-out:$@' elif $ar 2>&1 | grep -q "\[D\] "; then -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/http: copy only mime type from Content-Type
Content-Type can include charset and boundary which is not a part of mime type and shouldn't be copied as such. Fixes HLS playback when the Content-Type includes additional fields. Signed-off-by: Kacper Michajłow --- libavformat/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c index 0817aafb5b..378b90c52b 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1205,7 +1205,7 @@ static int process_line(URLContext *h, char *line, int line_count) } } else if (!av_strcasecmp(tag, "Content-Type")) { av_free(s->mime_type); -s->mime_type = av_strdup(p); +s->mime_type = av_get_token(&p, ";"); } else if (!av_strcasecmp(tag, "Set-Cookie")) { if (parse_cookie(s, p, &s->cookie_dict)) av_log(h, AV_LOG_WARNING, "Unable to parse '%s'\n", p); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avformat/http: copy only mime type from Content-Type
Content-Type can include charset and boundary which is not a part of mime type and shouldn't be copied as such. Fixes HLS playback when the Content-Type includes additional fields. Signed-off-by: Kacper Michajłow --- libavformat/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c index 0817aafb5b..fd931c2d8e 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1205,7 +1205,7 @@ static int process_line(URLContext *h, char *line, int line_count) } } else if (!av_strcasecmp(tag, "Content-Type")) { av_free(s->mime_type); -s->mime_type = av_strdup(p); +s->mime_type = av_get_token((const char **)&p, ";"); } else if (!av_strcasecmp(tag, "Set-Cookie")) { if (parse_cookie(s, p, &s->cookie_dict)) av_log(h, AV_LOG_WARNING, "Unable to parse '%s'\n", p); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] lavu/vulkan: fix handle type for 32-bit targets
Fixes compilation with clang which errors out on Wint-conversion. Signed-off-by: Kacper Michajłow --- libavutil/hwcontext_vulkan.c | 2 +- libavutil/vulkan.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 2a9b5f4aac..b3eccea7af 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1149,7 +1149,7 @@ static void free_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd) av_freep(&cmd->queues); av_freep(&cmd->bufs); -cmd->pool = NULL; +cmd->pool = VK_NULL_HANDLE; } static VkCommandBuffer get_buf_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd) diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h index d1ea1e24fb..90922c6cf3 100644 --- a/libavutil/vulkan.h +++ b/libavutil/vulkan.h @@ -122,7 +122,11 @@ typedef struct FFVulkanPipeline { VkDescriptorSetLayout *desc_layout; VkDescriptorPool desc_pool; VkDescriptorSet *desc_set; +#if VK_USE_64_BIT_PTR_DEFINES == 1 void **desc_staging; +#else +uint64_t *desc_staging; +#endif VkDescriptorSetLayoutBinding **desc_binding; VkDescriptorUpdateTemplate*desc_template; int *desc_set_initialized; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: allow linking to shared library with dllimport
Address of dll imported variables can't be used for constant initialization in C language modes. --- libavfilter/vf_libplacebo.c | 39 - 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 94e49aa465..f26d0126be 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -56,23 +56,6 @@ enum { TONE_MAP_COUNT, }; -static const struct pl_tone_map_function * const tonemapping_funcs[TONE_MAP_COUNT] = { -[TONE_MAP_AUTO] = &pl_tone_map_auto, -[TONE_MAP_CLIP] = &pl_tone_map_clip, -#if PL_API_VER >= 246 -[TONE_MAP_ST2094_40] = &pl_tone_map_st2094_40, -[TONE_MAP_ST2094_10] = &pl_tone_map_st2094_10, -#endif -[TONE_MAP_BT2390]= &pl_tone_map_bt2390, -[TONE_MAP_BT2446A] = &pl_tone_map_bt2446a, -[TONE_MAP_SPLINE]= &pl_tone_map_spline, -[TONE_MAP_REINHARD] = &pl_tone_map_reinhard, -[TONE_MAP_MOBIUS]= &pl_tone_map_mobius, -[TONE_MAP_HABLE] = &pl_tone_map_hable, -[TONE_MAP_GAMMA] = &pl_tone_map_gamma, -[TONE_MAP_LINEAR]= &pl_tone_map_linear, -}; - static const char *const var_names[] = { "in_w", "iw", ///< width of the input video frame "in_h", "ih", ///< height of the input video frame @@ -269,6 +252,26 @@ static void pl_av_log(void *log_ctx, enum pl_log_level level, const char *msg) av_log(log_ctx, av_lev, "%s\n", msg); } +static const struct pl_tone_map_function *pl_get_tonemapping_func(int tm) { +switch (tm) { +case TONE_MAP_AUTO: return &pl_tone_map_auto; +case TONE_MAP_CLIP: return &pl_tone_map_clip; +#if PL_API_VER >= 246 +case TONE_MAP_ST2094_40: return &pl_tone_map_st2094_40; +case TONE_MAP_ST2094_10: return &pl_tone_map_st2094_10; +#endif +case TONE_MAP_BT2390: return &pl_tone_map_bt2390; +case TONE_MAP_BT2446A:return &pl_tone_map_bt2446a; +case TONE_MAP_SPLINE: return &pl_tone_map_spline; +case TONE_MAP_REINHARD: return &pl_tone_map_reinhard; +case TONE_MAP_MOBIUS: return &pl_tone_map_mobius; +case TONE_MAP_HABLE: return &pl_tone_map_hable; +case TONE_MAP_GAMMA: return &pl_tone_map_gamma; +case TONE_MAP_LINEAR: return &pl_tone_map_linear; +default: av_assert0(0); +} +} + static int parse_shader(AVFilterContext *avctx, const void *shader, size_t len) { LibplaceboContext *s = avctx->priv; @@ -365,7 +368,7 @@ static int update_settings(AVFilterContext *ctx) s->color_map_params = *pl_color_map_params( .intent = s->intent, .gamut_mode = gamut_mode, -.tone_mapping_function = tonemapping_funcs[s->tonemapping], +.tone_mapping_function = pl_get_tonemapping_func(s->tonemapping), .tone_mapping_param = s->tonemapping_param, .tone_mapping_mode = tonemapping_mode, .inverse_tone_mapping = s->inverse_tonemapping, -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/jpegxl_parser: check entropy_decoder_read_symbol return value
Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavcodec/jpegxl_parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c index 8c45e1a1b7..746c429b9c 100644 --- a/libavcodec/jpegxl_parser.c +++ b/libavcodec/jpegxl_parser.c @@ -1311,7 +1311,7 @@ static int parse_frame_header(void *avctx, JXLParseContext *ctx, GetBitContext * // permuted toc if (get_bits1(gb)) { JXLEntropyDecoder dec; -uint32_t end, lehmer = 0; +int64_t end, lehmer = 0; ret = entropy_decoder_init(avctx, gb, &dec, 8); if (ret < 0) return ret; @@ -1320,13 +1320,13 @@ static int parse_frame_header(void *avctx, JXLParseContext *ctx, GetBitContext * return AVERROR_BUFFER_TOO_SMALL; } end = entropy_decoder_read_symbol(gb, &dec, toc_context(toc_count)); -if (end > toc_count) { +if (end < 0 || end > toc_count) { entropy_decoder_close(&dec); return AVERROR_INVALIDDATA; } for (uint32_t i = 0; i < end; i++) { lehmer = entropy_decoder_read_symbol(gb, &dec, toc_context(lehmer)); -if (get_bits_left(gb) < 0) { +if (lehmer < 0 || get_bits_left(gb) < 0) { entropy_decoder_close(&dec); return AVERROR_BUFFER_TOO_SMALL; } -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/af_ashowinfo: fix scaling factor of replaygain peak values
Fixes: 8542f9c4f17125d483c40c0c5723842f1c982f81 Signed-off-by: Kacper Michajłow --- libavfilter/af_ashowinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c index b83847b866..de94d4c7c2 100644 --- a/libavfilter/af_ashowinfo.c +++ b/libavfilter/af_ashowinfo.c @@ -120,7 +120,7 @@ static void print_peak(AVFilterContext *ctx, const char *str, uint32_t peak) if (!peak) av_log(ctx, AV_LOG_INFO, "unknown"); else -av_log(ctx, AV_LOG_INFO, "%f", (float)peak / UINT32_MAX); +av_log(ctx, AV_LOG_INFO, "%f", peak / 10.0f); av_log(ctx, AV_LOG_INFO, ", "); } -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avutil/file: fix av_file_map file mapping on Windows
This makes the behavior of av_file_map() the same on Windows as it is on other platforms. The file is opened as read-only, but the mapping is copy-on-write, allowing the user to write to the memory pages returned by av_file_map(). This commit fixes libavutil\tests\file.c test, which would crash when trying to write to a read-only memory page. Signed-off-by: Kacper Michajłow --- libavutil/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/file.c b/libavutil/file.c index db8507286b..4ef940a6c3 100644 --- a/libavutil/file.c +++ b/libavutil/file.c @@ -112,7 +112,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, return -1; } -ptr = MapViewOfFile(mh, FILE_MAP_READ, 0, 0, *size); +ptr = MapViewOfFile(mh, FILE_MAP_COPY, 0, 0, *size); CloseHandle(mh); if (!ptr) { av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in MapViewOfFile()\n"); -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/mov: fix eof check after avio_skip()
This fix ensures that the loop stops early on EOF. The issue occurs because mov_read_infe() performs a version check and skips unsupported versions. The problem is that seeking within the stream clears the EOF flag, causing avio_feof() to not function as expected. This is resolved by moving the EOF check after reading the size and type after seek, ensuring the EOF flag is set when necessary. Signed-off-by: Kacper Michajłow --- libavformat/mov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 2c8be51063..9a388bf723 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8868,12 +8868,12 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < entry_count; i++) { MOVAtom infe; +infe.size = avio_rb32(pb) - 8; +infe.type = avio_rl32(pb); if (avio_feof(pb)) { ret = AVERROR_INVALIDDATA; goto fail; } -infe.size = avio_rb32(pb) - 8; -infe.type = avio_rl32(pb); ret = mov_read_infe(c, pb, infe, i); if (ret < 0) goto fail; -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avformat/mov: fix eof check in mov_read_iinf()
This fix ensures that the loop stops early on EOF. The issue occurs because mov_read_infe() performs a version check and skips unsupported versions. The problem is that seeking within the stream clears the EOF flag, causing avio_feof() to not function as expected. This is resolved by moving the EOF check after reading the size and type, ensuring the EOF flag is set when necessary. Signed-off-by: Kacper Michajłow --- libavformat/mov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 2c8be51063..9a388bf723 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8868,12 +8868,12 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < entry_count; i++) { MOVAtom infe; +infe.size = avio_rb32(pb) - 8; +infe.type = avio_rl32(pb); if (avio_feof(pb)) { ret = AVERROR_INVALIDDATA; goto fail; } -infe.size = avio_rb32(pb) - 8; -infe.type = avio_rl32(pb); ret = mov_read_infe(c, pb, infe, i); if (ret < 0) goto fail; -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avutil/hwcontext_amf: fix crash on uninit after init failed
amf_device_create() calls amf_device_uninit() on errors, but if things were not initialized it will null deref amf_ctx->factory. Fixes: https://github.com/mpv-player/mpv/issues/15814 Signed-off-by: Kacper Michajłow --- libavutil/hwcontext_amf.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_amf.c b/libavutil/hwcontext_amf.c index 8e0ce1927e..5ba2ec5b07 100644 --- a/libavutil/hwcontext_amf.c +++ b/libavutil/hwcontext_amf.c @@ -339,7 +339,7 @@ static int amf_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, static void amf_device_uninit(AVHWDeviceContext *device_ctx) { AVAMFDeviceContext *amf_ctx = device_ctx->hwctx; -AMF_RESULT res; +AMF_RESULT res = AMF_NOT_INITIALIZED; AMFTrace *trace; if (amf_ctx->context) { @@ -348,7 +348,9 @@ static void amf_device_uninit(AVHWDeviceContext *device_ctx) amf_ctx->context = NULL; } -res = amf_ctx->factory->pVtbl->GetTrace(amf_ctx->factory, &trace); +if (amf_ctx->factory) +res = amf_ctx->factory->pVtbl->GetTrace(amf_ctx->factory, &trace); + if (res == AMF_OK) { trace->pVtbl->UnregisterWriter(trace, FFMPEG_AMF_WRITER_ID); } -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avfilter/af_ashowinfo: fix scaling factor of replaygain peak values
Commit 8542f9c4f17125d483c40c0c5723842f1c982f81 changed replaygain peak values to use 100k instead of UINT32_MAX as peak, with possibility of overflow. af_ashowinfo was never updated to reflect this, so we update it now. Fixes: 8542f9c4f17125d483c40c0c5723842f1c982f81 Signed-off-by: Kacper Michajłow --- libavfilter/af_ashowinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c index b83847b866..de94d4c7c2 100644 --- a/libavfilter/af_ashowinfo.c +++ b/libavfilter/af_ashowinfo.c @@ -120,7 +120,7 @@ static void print_peak(AVFilterContext *ctx, const char *str, uint32_t peak) if (!peak) av_log(ctx, AV_LOG_INFO, "unknown"); else -av_log(ctx, AV_LOG_INFO, "%f", (float)peak / UINT32_MAX); +av_log(ctx, AV_LOG_INFO, "%f", peak / 10.0f); av_log(ctx, AV_LOG_INFO, ", "); } -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/vqf: fix memory leak in add_metadata()
Signed-off-by: Kacper Michajłow --- libavformat/vqf.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 58b1546f53..fbe54739cd 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -66,10 +66,10 @@ static int add_metadata(AVFormatContext *s, uint32_t tag, return AVERROR(ENOMEM); ret = avio_read(s->pb, buf, len); -if (ret < 0) -return ret; -if (len != ret) -return AVERROR_INVALIDDATA; +if (ret < 0 || ret != len) { +av_free(buf); +return ret < 0 ? ret : AVERROR_INVALIDDATA; +} buf[len] = 0; AV_WL32(key, tag); return av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL); -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] tools/target_swr_fuzzer: fix memory leak on av_samples_fill_arrays() error
--- tools/target_swr_fuzzer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/target_swr_fuzzer.c b/tools/target_swr_fuzzer.c index f154a11632..59fa24af64 100644 --- a/tools/target_swr_fuzzer.c +++ b/tools/target_swr_fuzzer.c @@ -79,7 +79,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char out_layout_string[256]; uint8_t * ain[SWR_CH_MAX]; uint8_t *aout[SWR_CH_MAX]; -uint8_t *out_data; +uint8_t *out_data = NULL; int in_sample_nb; int out_sample_nb = size; int count; @@ -145,9 +145,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { count = swr_convert(swr, aout, out_sample_nb, (const uint8_t **)ain, in_sample_nb); -av_freep(&out_data); - end: +av_freep(&out_data); swr_free(&swr); return 0; -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avutil/intmath: use AV_HAS_BUILTIN to detect builtin availability
Fixes use of bultins on clang x86_64-pc-windows-msvc which does not define any __GNUC__. Also on other targets __GNUC__ is defined to 4 by default, so any feature testing based on version is not really valid. Signed-off-by: Kacper Michajłow --- libavutil/intmath.h | 12 +--- libavutil/x86/intmath.h | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/libavutil/intmath.h b/libavutil/intmath.h index 52e11a8d5f..b177a848c6 100644 --- a/libavutil/intmath.h +++ b/libavutil/intmath.h @@ -35,7 +35,7 @@ #endif #if HAVE_FAST_CLZ -#if AV_GCC_VERSION_AT_LEAST(3,4) +#if AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_clz) #ifndef ff_log2 # define ff_log2(x) (31 - __builtin_clz((x)|1)) # ifndef ff_log2_16bit @@ -90,18 +90,16 @@ static av_always_inline av_const int ff_log2_16bit_c(unsigned int v) */ #if HAVE_FAST_CLZ -#if AV_GCC_VERSION_AT_LEAST(3,4) -#ifndef ff_ctz +#if !defined(ff_ctz) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_ctz)) #define ff_ctz(v) __builtin_ctz(v) #endif -#ifndef ff_ctzll +#if !defined(ff_ctzll) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_ctzll)) #define ff_ctzll(v) __builtin_ctzll(v) #endif -#ifndef ff_clz +#if !defined(ff_clz) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_clz)) #define ff_clz(v) __builtin_clz(v) #endif #endif -#endif #ifndef ff_ctz #define ff_ctz ff_ctz_c @@ -154,7 +152,7 @@ static av_always_inline av_const unsigned ff_clz_c(unsigned x) } #endif -#if AV_GCC_VERSION_AT_LEAST(3,4) +#if AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_parity) #ifndef av_parity #define av_parity __builtin_parity #endif diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h index 4893a1f1b4..030ded6b6f 100644 --- a/libavutil/x86/intmath.h +++ b/libavutil/x86/intmath.h @@ -66,7 +66,7 @@ static av_always_inline av_const int ff_ctzll_x86(long long v) #endif /* HAVE_FAST_CLZ */ -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) /* Our generic version of av_popcount is faster than GCC's built-in on * CPUs that don't support the popcnt instruction. @@ -81,7 +81,7 @@ static av_always_inline av_const int ff_ctzll_x86(long long v) #if defined(__BMI2__) -#if AV_GCC_VERSION_AT_LEAST(5,1) +#if AV_GCC_VERSION_AT_LEAST(5,1) || AV_HAS_BUILTIN(__builtin_ia32_bzhi_si) #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 #define av_zero_extend av_zero_extend_bmi2 static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsigned p) -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 0/6] Minor fixes and for fuzzing targets
Minor fixes and for fuzzing targets. Mostly motivated to reduce spam in the build log. While at it, tiff/tdsc check was fixed, which was real bug. Kacper Michajłow (6): tools/Makefile: add identifier macros for specific fuzzing targets tools/target_dec_fuzzer: fix tiff/tdsc check tools/target_dec_fuzzer: 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/Makefile| 8 +++ tools/target_dec_fuzzer.c | 46 --- tools/target_dem_fuzzer.c | 5 + 3 files changed, 33 insertions(+), 26 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/6] tools/Makefile: add identifier macros for specific fuzzing targets
This will allow to add conditional code per target codec. Signed-off-by: Kacper Michajłow --- tools/Makefile | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 7ae6e3cb75..3f99b337e5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -3,16 +3,16 @@ TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs TOOLS-$(CONFIG_ZLIB) += cws2fws tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c - $(COMPILE_C) -DFFMPEG_DECODER=$* + $(COMPILE_C) -DFFMPEG_DECODER=$* -DFFMPEG_DECODER_$* tools/target_enc_%_fuzzer.o: tools/target_enc_fuzzer.c - $(COMPILE_C) -DFFMPEG_ENCODER=$* + $(COMPILE_C) -DFFMPEG_ENCODER=$* -DFFMPEG_ENCODER_$* tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c - $(COMPILE_C) -DFFMPEG_BSF=$* + $(COMPILE_C) -DFFMPEG_BSF=$* -DFFMPEG_BSF_$* tools/target_dem_%_fuzzer.o: tools/target_dem_fuzzer.c - $(COMPILE_C) -DFFMPEG_DEMUXER=$* -DIO_FLAT=0 + $(COMPILE_C) -DFFMPEG_DEMUXER=$* -DFFMPEG_DEMUXER_$* -DIO_FLAT=0 tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c $(COMPILE_C) -DIO_FLAT=1 -- 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/6] tools/target_dec_fuzzer: suppress Wdeclaration-after-statement
To avoid spam in log, each fuzzer is built separately so it's amplified a lot. Signed-off-by: Kacper Michajłow --- tools/target_dec_fuzzer.c | 41 +++ 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index de0419430f..a15f1a3f9c 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -166,6 +166,12 @@ static int fuzz_get_buffer2(AVCodecContext *ctx, AVFrame *frame, int flags) } } +#define DECODER_SYMBOL0(CODEC) ff_##CODEC##_decoder +#define DECODER_SYMBOL(CODEC) DECODER_SYMBOL0(CODEC) + +extern FFCodec DECODER_SYMBOL(FFMPEG_DECODER); +extern FFCodec DECODER_SYMBOL(mjpeg); + int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { uint64_t maxpixels_per_frame = 4096 * 4096; uint64_t maxpixels; @@ -185,16 +191,19 @@ 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 -#define DECODER_SYMBOL0(CODEC) ff_##CODEC##_decoder -#define DECODER_SYMBOL(CODEC) DECODER_SYMBOL0(CODEC) -extern FFCodec DECODER_SYMBOL(FFMPEG_DECODER); codec_list[0] = &DECODER_SYMBOL(FFMPEG_DECODER); #if defined(FFMPEG_DECODER_tiff) || defined(FFMPEG_DECODER_tdsc) -extern FFCodec DECODER_SYMBOL(mjpeg); codec_list[1] = &DECODER_SYMBOL(mjpeg); #endif @@ -341,8 +350,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"); @@ -472,7 +481,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) { avcodec_free_context(&ctx); av_free(parser_avctx); @@ -484,11 +493,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 +570,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 +589,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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/6] tools/target_dec_fuzzer: fix tiff/tdsc check
Comparing `FFMPEG_DECODER == tiff` never worked because tiff is not defined. Original commit expected string compare, but C preprocesor doesn't work this way. Fixes: 3371d0611fcd31e0bc72553d88774512a58bd2ef Signed-off-by: Kacper Michajłow --- tools/target_dec_fuzzer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index b3be69f94d..de0419430f 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -193,7 +193,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { extern FFCodec DECODER_SYMBOL(FFMPEG_DECODER); codec_list[0] = &DECODER_SYMBOL(FFMPEG_DECODER); -#if FFMPEG_DECODER == tiff || FFMPEG_DECODER == tdsc +#if defined(FFMPEG_DECODER_tiff) || defined(FFMPEG_DECODER_tdsc) extern FFCodec DECODER_SYMBOL(mjpeg); codec_list[1] = &DECODER_SYMBOL(mjpeg); #endif -- 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/6] tools/target_dec_fuzzer: suppress Wunused-function
Signed-off-by: Kacper Michajłow --- 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 a15f1a3f9c..7bbf1375d0 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 6/6] tools/target_dem_fuzzer: remove unused fuzz_tag
Signed-off-by: Kacper Michajłow --- 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= 5; -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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/6] tools/target_dem_fuzzer: make fuzz data pointer constant
Mostly to avoid warnings. Signed-off-by: Kacper Michajłow --- 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] tools/target_swr_fuzzer: fix memory leak on av_samples_fill_arrays() error
Signed-off-by: Kacper Michajłow --- tools/target_swr_fuzzer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/target_swr_fuzzer.c b/tools/target_swr_fuzzer.c index f154a11632..59fa24af64 100644 --- a/tools/target_swr_fuzzer.c +++ b/tools/target_swr_fuzzer.c @@ -79,7 +79,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char out_layout_string[256]; uint8_t * ain[SWR_CH_MAX]; uint8_t *aout[SWR_CH_MAX]; -uint8_t *out_data; +uint8_t *out_data = NULL; int in_sample_nb; int out_sample_nb = size; int count; @@ -145,9 +145,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { count = swr_convert(swr, aout, out_sample_nb, (const uint8_t **)ain, in_sample_nb); -av_freep(&out_data); - end: +av_freep(&out_data); swr_free(&swr); return 0; -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] w32pthreads: add support for setting thread name
Signed-off-by: Kacper Michajłow --- compat/w32pthreads.h | 30 ++ libavutil/thread.h | 2 ++ 2 files changed, 32 insertions(+) diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h index fd6428e29f..83b4819205 100644 --- a/compat/w32pthreads.h +++ b/compat/w32pthreads.h @@ -44,6 +44,7 @@ #include "libavutil/internal.h" #include "libavutil/mem.h" #include "libavutil/time.h" +#include "libavutil/wchar_filename.h" typedef struct pthread_t { void *handle; @@ -209,4 +210,33 @@ static inline int pthread_setcancelstate(int state, int *oldstate) return 0; } +static inline int win32_thread_setname(const char *name) +{ +typedef HRESULT (WINAPI *SetThreadDescriptionFn)(HANDLE, PCWSTR); +SetThreadDescriptionFn pSetThreadDescription; +HRESULT hr; +wchar_t *wname; + +#if !HAVE_UWP +HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll"); +if (!kernel32) +return ENOSYS; +pSetThreadDescription = (SetThreadDescriptionFn) +GetProcAddress(kernel32, "SetThreadDescription"); +if (!pSetThreadDescription) +return ENOSYS; +#else +WINBASEAPI HRESULT WINAPI +SetThreadDescription(HANDLE hThread, PCWSTR lpThreadDescription); +pSetThreadDescription = &SetThreadDescription; +#endif + +if (utf8towchar(name, &wname) < 0) +return ENOMEM; + +hr = pSetThreadDescription(GetCurrentThread(), wname); +av_free(wname); +return SUCCEEDED(hr) ? 0 : EINVAL; +} + #endif /* COMPAT_W32PTHREADS_H */ diff --git a/libavutil/thread.h b/libavutil/thread.h index 2c00c7cc35..d1a36a6772 100644 --- a/libavutil/thread.h +++ b/libavutil/thread.h @@ -229,6 +229,8 @@ static inline int ff_thread_setname(const char *name) #endif #elif HAVE_PTHREAD_SET_NAME_NP pthread_set_name_np(pthread_self(), name); +#elif HAVE_W32THREADS +ret = AVERROR(win32_thread_setname(name)); #else ret = AVERROR(ENOSYS); #endif -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] w32pthreads: add support for setting thread name
Signed-off-by: Kacper Michajłow --- compat/w32pthreads.h | 30 ++ libavutil/thread.h | 2 ++ 2 files changed, 32 insertions(+) diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h index fd6428e29f..8d5b4729fa 100644 --- a/compat/w32pthreads.h +++ b/compat/w32pthreads.h @@ -44,6 +44,7 @@ #include "libavutil/internal.h" #include "libavutil/mem.h" #include "libavutil/time.h" +#include "libavutil/wchar_filename.h" typedef struct pthread_t { void *handle; @@ -209,4 +210,33 @@ static inline int pthread_setcancelstate(int state, int *oldstate) return 0; } +static inline int win32_thread_setname(const char *name) +{ +typedef HRESULT (WINAPI *SetThreadDescriptionFn)(HANDLE, PCWSTR); +SetThreadDescriptionFn pSetThreadDescription; +HRESULT hr; +wchar_t *wname; + +#if !HAVE_UWP +HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll"); +if (!kernel32) +return AVERROR(ENOSYS); +pSetThreadDescription = (SetThreadDescriptionFn) +GetProcAddress(kernel32, "SetThreadDescription"); +if (!pSetThreadDescription) +return AVERROR(ENOSYS); +#else +WINBASEAPI HRESULT WINAPI +SetThreadDescription(HANDLE hThread, PCWSTR lpThreadDescription); +pSetThreadDescription = &SetThreadDescription; +#endif + +if (utf8towchar(name, &wname) < 0) +return AVERROR(ENOMEM); + +hr = pSetThreadDescription(GetCurrentThread(), wname); +av_free(wname); +return SUCCEEDED(hr) ? 0 : AVERROR(EINVAL); +} + #endif /* COMPAT_W32PTHREADS_H */ diff --git a/libavutil/thread.h b/libavutil/thread.h index 2c00c7cc35..184e2d8c5f 100644 --- a/libavutil/thread.h +++ b/libavutil/thread.h @@ -229,6 +229,8 @@ static inline int ff_thread_setname(const char *name) #endif #elif HAVE_PTHREAD_SET_NAME_NP pthread_set_name_np(pthread_self(), name); +#elif HAVE_W32THREADS +ret = win32_thread_setname(name); #else ret = AVERROR(ENOSYS); #endif -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avformat/internal: add missing __clang__ check
Clang x86_64-pc-windows-msvc doesn't define __GNUC__. Signed-off-by: Kacper Michajłow --- libavformat/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index fe428d85eb..bf83571430 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -354,7 +354,7 @@ static av_always_inline const FFStream *cffstream(const AVStream *st) return (const FFStream*)st; } -#ifdef __GNUC__ +#if defined (__GNUC__) || defined (__clang__) #define dynarray_add(tab, nb_ptr, elem)\ do {\ __typeof__(tab) _tab = (tab);\ -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avformat/demux: use io_close2 when closing avfromat
It's not valid to call avio_close() on context that has not been open with avio_open(). This fixes use of custom IO. (io_open / io_close2 callbacks) Note that by default io_close2 is set to io_close2_default() which calls avio_close(), so default case will work the same as before. Signed-off-by: Kacper Michajłow --- libavformat/demux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index 2795863567..ecd4f40da9 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -383,11 +383,10 @@ void avformat_close_input(AVFormatContext **ps) if (ffifmt(s->iformat)->read_close) ffifmt(s->iformat)->read_close(s); +ff_format_io_close(s, &pb); avformat_free_context(s); *ps = NULL; - -avio_close(pb); } static void force_codec_ids(AVFormatContext *s, AVStream *st) -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avformat/imfdec: inherit opaque from parent AVFormatContext
io_open and io_close2 callbacks may use opaque pointer stored in the context. They are already inherited, so opaque should also be passed through. Fixes IMF playback in mpv. Signed-off-by: Kacper Michajłow --- libavformat/imfdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index a86b4763ff..b4df37daa3 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -380,6 +380,7 @@ static int open_track_resource_context(AVFormatContext *s, track_resource->ctx->io_open = s->io_open; track_resource->ctx->io_close2 = s->io_close2; +track_resource->ctx->opaque = s->opaque; track_resource->ctx->flags |= s->flags & ~AVFMT_FLAG_CUSTOM_IO; if ((ret = ff_copy_whiteblacklists(track_resource->ctx, s)) < 0) -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] configure: use proper Windows-style static library naming
On Windows, static libraries are typically named with a .lib extension. An exception to this is MinGW targets, which are treated as a distinct target-os. Using Windows-style naming allows Clang to be used as the linker driver, instead of invoking link or lld-link directly. The latter approach requires manually specifying standard libraries, which may be error-prone or incomplete. This change also improves support for LTO and sanitizer builds, where it's significantly easier to let the compiler driver manage the necessary linker flags. It fixes issues where Clang is asked to `-lavcodec`, which gets passed to the linker as avcodec.lib, resulting in an error like: lld-link: error: could not open 'avcodec.lib': no such file or directory This happens because `libavcodec.a` were unexpectedly generated, not `avcodec.lib` expected by tooling. Note that this doesn't affect mingw build. MSVC builds work the same, because there libraries are passed as files directly to linker command. This also removes LD_LIB from Win32/64 target as there is one type of .lib in practice. We cannot build both shared and static as noted by the next line. Signed-off-by: Kacper Michajłow --- configure | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure b/configure index e2e9fc26d8..c57da316cc 100755 --- a/configure +++ b/configure @@ -5062,6 +5062,7 @@ probe_cc(){ _depflags='-MMD -MF $(@:.o=.d) -MT $@' _cflags_speed='-O3' _cflags_size='-Oz' +_ld_lib='-l%' elif $_cc -V 2>&1 | grep -q Sun; then _type=suncc _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-) @@ -5107,7 +5108,7 @@ probe_cc(){ _cc_o='-Fo$@' _cc_e='-P' _flags_filter=icl_flags -_ld_lib='lib%.a' +_ld_lib='%.lib' _ld_path='-libpath:' # -Qdiag-error to make icl error when seeing certain unknown arguments _flags='-nologo -Qdiag-error:4044,10157' @@ -5125,7 +5126,7 @@ probe_cc(){ _ident=$($_cc -flavor gnu --version 2>/dev/null) _ld_o='-out:$@' _flags_filter=msvc_flags -_ld_lib='lib%.a' +_ld_lib='%.lib' _ld_path='-libpath:' elif $_cc -nologo- 2>&1 | grep -q ^Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then _type=msvc @@ -5152,7 +5153,7 @@ probe_cc(){ _cc_o='-Fo$@' _cc_e='-P -Fi$@' _flags_filter=msvc_flags -_ld_lib='lib%.a' +_ld_lib='%.lib' _ld_path='-libpath:' _flags='-nologo' disable stripping @@ -5931,9 +5932,6 @@ case $target_os in win32|win64) disable symver if enabled shared; then -# Link to the import library instead of the normal static library -# for shared libs. -LD_LIB='%.lib' # Cannot build both shared and static libs with MSVC or icl. disable static fi @@ -5941,6 +5939,8 @@ case $target_os in enabled x86_32 && check_ldflags -LARGEADDRESSAWARE add_cppflags -DWIN32_LEAN_AND_MEAN shlibdir_default="$bindir_default" +LIBPREF="" +LIBSUF=".lib" SLIBPREF="" SLIBSUF=".dll" SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] configure: add -Wl when linker is called indirectly
It's possible to call linker indirectly through driver like Clang. In which cases linker args has to be prefixed with -Wl. Signed-off-by: Kacper Michajłow --- configure | 5 + 1 file changed, 5 insertions(+) diff --git a/configure b/configure index c57da316cc..a5c3bd3917 100755 --- a/configure +++ b/configure @@ -5951,6 +5951,11 @@ case $target_os in SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' +if test $ld_type = "clang"; then +SHFLAGS='-Wl,-dll -Wl,-def:$$(@:$(SLIBSUF)=.def) -Wl,-implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' +else +SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' +fi enabled x86_64 && objformat="win64" || objformat="win32" ranlib=: enable dos_paths -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] configure: add -Wl when linker is called indirectly
It's possible to call linker indirectly through driver like Clang. In which cases linker args has to be prefixed with -Wl. Signed-off-by: Kacper Michajłow --- configure | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index c57da316cc..0dede08356 100755 --- a/configure +++ b/configure @@ -5950,7 +5950,11 @@ case $target_os in SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' -SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' +if test $ld_type = "clang"; then +SHFLAGS='-Wl,-dll -Wl,-def:$$(@:$(SLIBSUF)=.def) -Wl,-implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' +else +SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' +fi enabled x86_64 && objformat="win64" || objformat="win32" ranlib=: enable dos_paths -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] configure: fix Microsoft tools detection
LLVM tools print installation path upon execution. If one uses LLVM tools bundled with Microsoft Visual Studio installation, they would be incorrectly detected as Microsoft's ones. Microsoft tools can have localized names, so a more specific string check is not feasible, but luckily we can test if "Microsoft" is at the beginning of the line, as it is always the case. Signed-off-by: Kacper Michajłow --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 534b443f7d..5b2a04ae6a 100755 --- a/configure +++ b/configure @@ -5124,9 +5124,9 @@ probe_cc(){ _flags_filter=msvc_flags _ld_lib='lib%.a' _ld_path='-libpath:' -elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then +elif $_cc -nologo- 2>&1 | grep -q ^Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then _type=msvc -if $_cc -nologo- 2>&1 | grep -q Microsoft; then +if $_cc -nologo- 2>&1 | grep -q ^Microsoft; then _ident=$($_cc 2>&1 | head -n1 | tr -d '\r') else _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r') @@ -5236,7 +5236,7 @@ if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then DEPCCFLAGS=$_flags fi -if $ar 2>&1 | grep -q Microsoft; then +if $ar 2>&1 | grep -q ^Microsoft; then arflags="-nologo" ar_o='-out:$@' elif $ar 2>&1 | grep -q "\[D\] "; then -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 0/4] Minor fixes and for fuzzing targets
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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/4] tools/target_dec_fuzzer: move things to suppress Wdeclaration-after-statement
To avoid spam in log, each fuzzer is built separately so it's amplified a lot. Signed-off-by: Kacper Michajłow --- 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/4] tools/target_dec_fuzzer: suppress Wunused-function
Signed-off-by: Kacper Michajłow --- 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/4] tools/target_dem_fuzzer: make fuzz data pointer constant
Mostly to avoid warnings. Signed-off-by: Kacper Michajłow --- 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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 4/4] tools/target_dem_fuzzer: remove unused fuzz_tag
Signed-off-by: Kacper Michajłow --- 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= 5; -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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] configure: treat unrecognized flags as errors on MSVC
This is important for feature checking to work correctly. It can happen that a unrecognized flag is passing compile test with a warning only, while failing in preprocessor only mode with an error. This makes all test_cpp calls fail and silently produces arguably broken MSVC builds. Also all check_* doesn't work as expected, because they think check passed, while there was an warning. Additionally this make it in-line with GCC/Clang based builds. To test for unrecognized and bail out early, instead of silently doing whole build only producing warnings in log. The /options:strict option is available starting in Visual Studio 2022 version 17.0. Because of that we cannot use check_cflags alone, it would just also add this flag for older MSVC and produce warnings. So we need to manually version check. Kind of chicken and egg problem. Do the check before adding extra flags from the user, to ensure that we don't fail silently preprocessor check, with invalid flags on older MSVC. Note that it behaves differently depending if we are compiling or preprocessing only. Use check_cflags even after version check, for non-MSVC compilers that might impersonate MSVC, but not have support for this flag. Clang-CL sets _MSC_FULL_VER as one example. Signed-off-by: Kacper Michajłow --- configure | 6 ++ 1 file changed, 6 insertions(+) diff --git a/configure b/configure index ed6430ea32..20276a3c4f 100755 --- a/configure +++ b/configure @@ -5276,6 +5276,12 @@ else ar_o='$@' fi +# Treat unrecognized flags as errors on MSVC +test_cpp_condition windows.h "_MSC_FULL_VER >= 193030705" && +check_cflags -options:strict +test_host_cpp_condition windows.h "_MSC_FULL_VER >= 193030705" && +check_host_cflags -options:strict + add_cflags $extra_cflags add_cxxflags $extra_cxxflags add_objcflags $extra_objcflags -- 2.50.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/scd: ensure SCD_MIN_HEADER_SIZE bytes are read
Instead of accessing unintialized data when input is shorter than expected size. Fixes use of uninitialized value in MSAN build. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow --- libavformat/scd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/scd.c b/libavformat/scd.c index ee118c1668..e57733a8d8 100644 --- a/libavformat/scd.c +++ b/libavformat/scd.c @@ -30,6 +30,7 @@ #include "libavutil/mem.h" #include "libavformat/internal.h" #include "avformat.h" +#include "avio_internal.h" #include "demux.h" #define SCD_MAGIC ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \ @@ -243,7 +244,7 @@ static int scd_read_header(AVFormatContext *s) SCDDemuxContext *ctx = s->priv_data; uint8_t buf[SCD_MIN_HEADER_SIZE]; -if ((ret = avio_read(s->pb, buf, SCD_MIN_HEADER_SIZE)) < 0) +if ((ret = ffio_read_size(s->pb, buf, SCD_MIN_HEADER_SIZE)) < 0) return ret; ctx->hdr.magic = AV_RB64(buf + 0); -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] MAINTAINERS: add myself
Signed-off-by: Kacper Michajłow --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 07cea8afeb..650300dadc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -547,6 +547,7 @@ James Darnley Jan Ekström Joakim Plate Jun Zhao +Kacper Michajłow Kieran Kunhya Kirill Gavrilov Limin Wang -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/subfile: clip seek offset
Fixes: signed integer overflow: 9223372036854737920 + 1649410 cannot be represented in type 'int64_t' Fixes OSS-Fuzz: 410100610 Signed-off-by: Kacper Michajłow --- libavformat/subfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/subfile.c b/libavformat/subfile.c index be48ef72ef..b8c6ce0eef 100644 --- a/libavformat/subfile.c +++ b/libavformat/subfile.c @@ -128,13 +128,13 @@ static int64_t subfile_seek(URLContext *h, int64_t pos, int whence) case AVSEEK_SIZE: return end - c->start; case SEEK_SET: -new_pos = c->start + pos; +new_pos = c->start + av_clip(pos, 0, end - c->start); break; case SEEK_CUR: -new_pos = c->pos + pos; +new_pos = c->pos + av_clip(pos, -(c->pos - c->start), end - c->pos); break; case SEEK_END: -new_pos = end + pos; +new_pos = end + av_clip(pos, -(end - c->start), 0); break; default: av_assert0(0); -- 2.47.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] checkasm/swscale: fix function prototypes
This aligns declared function types in checkasm with real definition. Fixes FATE: checkasm-{sw_rgb,sw_scale,sw_yuv2rgb,sw_yuv2yuv} Fixes: runtime error: call to function through pointer to incorrect function type Fixes: c1a0e657638f7007dcc807a2d985c22631fcd6d3 Signed-off-by: Kacper Michajłow --- tests/checkasm/sw_rgb.c | 2 +- tests/checkasm/sw_scale.c | 8 tests/checkasm/sw_yuv2rgb.c | 6 +++--- tests/checkasm/sw_yuv2yuv.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c index b98c7c6b47..6edfc93b0b 100644 --- a/tests/checkasm/sw_rgb.c +++ b/tests/checkasm/sw_rgb.c @@ -142,7 +142,7 @@ static void check_rgb24toyv12(SwsContext *sws) declare_func(void, const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, - int chromStride, int srcStride, int32_t *rgb2yuv); + int chromStride, int srcStride, const int32_t *rgb2yuv); randomize_buffers(src, BUFSIZE * 3); diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c index 11c9174a6b..b91e0b64ed 100644 --- a/tests/checkasm/sw_scale.c +++ b/tests/checkasm/sw_scale.c @@ -362,7 +362,7 @@ static void check_hscale(void) // The dst parameter here is either int16_t or int32_t but we use void* to // just cover both cases. -declare_func(void, void *c, void *dst, int dstW, +declare_func(void, SwsInternal *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize); @@ -422,11 +422,11 @@ static void check_hscale(void) memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0])); memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0])); -call_ref(NULL, dst0, sws->dst_w, src, filter, filterPos, width); -call_new(NULL, dst1, sws->dst_w, src, filterAvx2, filterPosAvx, width); +call_ref(NULL, (int16_t *)dst0, sws->dst_w, src, filter, filterPos, width); +call_new(NULL, (int16_t *)dst1, sws->dst_w, src, filterAvx2, filterPosAvx, width); if (memcmp(dst0, dst1, sws->dst_w * sizeof(dst0[0]))) fail(); -bench_new(NULL, dst0, sws->dst_w, src, filter, filterPosAvx, width); +bench_new(NULL, (int16_t *)dst0, sws->dst_w, src, filter, filterPosAvx, width); } } } diff --git a/tests/checkasm/sw_yuv2rgb.c b/tests/checkasm/sw_yuv2rgb.c index c25fb99ca2..c6c1ad934b 100644 --- a/tests/checkasm/sw_yuv2rgb.c +++ b/tests/checkasm/sw_yuv2rgb.c @@ -107,9 +107,9 @@ static void check_yuv2rgb(int src_pix_fmt) static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE}; declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, - int, SwsInternal *c, const uint8_t *src[], - int srcStride[], int srcSliceY, int srcSliceH, - uint8_t *dst[], int dstStride[]); + int, SwsInternal *c, const uint8_t *const src[], + const int srcStride[], int srcSliceY, int srcSliceH, + uint8_t *const dst[], const int dstStride[]); LOCAL_ALIGNED_8(uint8_t, src_y, [MAX_LINE_SIZE * 2]); LOCAL_ALIGNED_8(uint8_t, src_u, [MAX_LINE_SIZE]); diff --git a/tests/checkasm/sw_yuv2yuv.c b/tests/checkasm/sw_yuv2yuv.c index 6fe8e47d19..6a7a7a8b9a 100644 --- a/tests/checkasm/sw_yuv2yuv.c +++ b/tests/checkasm/sw_yuv2yuv.c @@ -46,9 +46,9 @@ static void check_semiplanar(int dst_pix_fmt) static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE}; declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, - int, SwsInternal *c, const uint8_t *src[], - int srcStride[], int srcSliceY, int srcSliceH, - uint8_t *dst[], int dstStride[]); + int, SwsInternal *c, const uint8_t *const src[], + const int srcStride[], int srcSliceY, int srcSliceH, + uint8_t *const dstParam[], const int dstStride[]); LOCAL_ALIGNED_8(uint8_t, src_y, [MAX_LINE_SIZE * NUM_LINES]); LOCAL_ALIGNED_8(uint8_t, src_uv, [MAX_LINE_SIZE * NUM_LINES * 2]); -- 2.43.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avcodec/opus: don't materialize buf pointer from null
Fixes: avcodec/opus/dec.c: runtime error: applying non-zero offset 10 to null pointer Signed-off-by: Kacper Michajłow --- libavcodec/opus/dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/opus/dec.c b/libavcodec/opus/dec.c index 6c59dc1f46..dbefcddb0c 100644 --- a/libavcodec/opus/dec.c +++ b/libavcodec/opus/dec.c @@ -585,6 +585,9 @@ static int opus_decode_packet(AVCodecContext *avctx, AVFrame *frame, s->decoded_samples = ret; decoded_samples = FFMIN(decoded_samples, ret); +if (!buf) +continue; + buf += s->packet.packet_size; buf_size -= s->packet.packet_size; } -- 2.47.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avutil/avstring: shrink allocation from av_get_token to fit token
av_get_token() allocates an output buffer with the same size as the input. Generally, this is harmless, but when the input string is large and consists of many small tokens, calling av_get_token() repeatedly to extract all tokens will significantly amplify memory allocations. To fix this, after obtaining the return value, simply realloc the buffer to the actual size needed for output string. Fixes OOM when parsing filter graph string. Fixes OSS-Fuzz: 394983446 Signed-off-by: Kacper Michajłow --- libavutil/avstring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 875eb691db..b4266aefe5 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -142,7 +142,7 @@ end: char *av_get_token(const char **buf, const char *term) { -char *out = av_malloc(strlen(*buf) + 1); +char *out = av_realloc(NULL, strlen(*buf) + 1); char *ret = out, *end = out; const char *p = *buf; if (!out) @@ -172,7 +172,7 @@ char *av_get_token(const char **buf, const char *term) *buf = p; -return ret; +return av_realloc(ret, out - ret + 2); } char *av_strtok(char *s, const char *delim, char **saveptr) -- 2.47.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avutil/avstring: shrink allocation from av_get_token to fit token
av_get_token() allocates an output buffer with the same size as the input. Generally, this is harmless, but when the input string is large and consists of many small tokens, calling av_get_token() repeatedly to extract all tokens will significantly amplify memory allocations. To fix this, after obtaining the return value, simply realloc the buffer to the actual size needed for output string. Fixes OOM when parsing filter graph string. Fixes OSS-Fuzz: 394983446 Signed-off-by: Kacper Michajłow --- libavutil/avstring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 875eb691db..281c5cdc88 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -142,7 +142,7 @@ end: char *av_get_token(const char **buf, const char *term) { -char *out = av_malloc(strlen(*buf) + 1); +char *out = av_realloc(NULL, strlen(*buf) + 1); char *ret = out, *end = out; const char *p = *buf; if (!out) @@ -172,7 +172,8 @@ char *av_get_token(const char **buf, const char *term) *buf = p; -return ret; +char *small_ret = av_realloc(ret, out - ret + 2); +return small_ret ? small_ret : ret; } char *av_strtok(char *s, const char *delim, char **saveptr) -- 2.47.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] fftools/cmdutils: don't try to load arguments from file if not needed
CLI option parser checks if argument exists when needed, but in this case only OPT_TYPE_BOOL where checked, so OPT_TYPE_FUNC without argument where trying to load a file from `arg` which is NULL in this case. Fixes crash on `ffmpeg -/version` Fixes: 6d17991b7e1bf1a5d104c8a6261709f7e6640d97 Signed-off-by: Kacper Michajłow --- fftools/cmdutils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index be21ed2c6c..e442935cae 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -255,9 +255,10 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, if (*opt == '/') { opt++; -if (po->type == OPT_TYPE_BOOL) { +if (!opt_has_arg(po)) { av_log(NULL, AV_LOG_FATAL, - "Requested to load an argument from file for a bool option '%s'\n", + "Requested to load an argument from file for an option '%s'" + " which does not take an argument\n", po->name); return AVERROR(EINVAL); } -- 2.45.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".