[FFmpeg-cvslog] avcodec/libvpxenc: Apply codec options to alpha codec context
ffmpeg | branch: master | Adam Chelminski | Fri Sep 3 10:32:06 2021 +0200| [715f63232fc91f69b7505832437d3ef245fc6232] | committer: James Zern avcodec/libvpxenc: Apply codec options to alpha codec context When encoding yuva420 (alpha) frames, the vpx encoder uses a second vpx_codec_ctx to encode the alpha stream. However, codec options were only being applied to the primary encoder. This patch updates codecctl_int and codecctl_intp to also apply codec options to the alpha codec context when encoding frames with alpha. This is necessary to take advantage of libvpx speed optimizations such as 'row-mt' and 'cpu-used' when encoding videos with alpha. Without this patch, the speed optimizations are only applied to the primary stream encoding, and the overall encoding is just as slow as it would be without the options specified. Signed-off-by: Adam Chelminski Signed-off-by: James Zern > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=715f63232fc91f69b7505832437d3ef245fc6232 --- libavcodec/libvpxenc.c | 26 -- libavcodec/version.h | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 0e50fbfd7c..f66345e998 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -385,9 +385,20 @@ static av_cold int codecctl_int(AVCodecContext *avctx, snprintf(buf, sizeof(buf), "Failed to set %s codec control", ctlidstr[id]); log_encoder_error(avctx, buf); +return AVERROR(EINVAL); } -return res == VPX_CODEC_OK ? 0 : AVERROR(EINVAL); +if (ctx->is_alpha) { +int res_alpha = vpx_codec_control(>encoder_alpha, id, val); +if (res_alpha != VPX_CODEC_OK) { +snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control", + ctlidstr[id]); +log_encoder_error(avctx, buf); +return AVERROR(EINVAL); +} +} + +return 0; } #if VPX_ENCODER_ABI_VERSION >= 12 @@ -407,9 +418,20 @@ static av_cold int codecctl_intp(AVCodecContext *avctx, snprintf(buf, sizeof(buf), "Failed to set %s codec control", ctlidstr[id]); log_encoder_error(avctx, buf); +return AVERROR(EINVAL); } -return res == VPX_CODEC_OK ? 0 : AVERROR(EINVAL); +if (ctx->is_alpha) { +int res_alpha = vpx_codec_control(>encoder_alpha, id, val); +if (res_alpha != VPX_CODEC_OK) { +snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control", + ctlidstr[id]); +log_encoder_error(avctx, buf); +return AVERROR(EINVAL); +} +} + +return 0; } #endif diff --git a/libavcodec/version.h b/libavcodec/version.h index 83db2b242a..4b4fe543ab 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 59 #define LIBAVCODEC_VERSION_MINOR 7 -#define LIBAVCODEC_VERSION_MICRO 102 +#define LIBAVCODEC_VERSION_MICRO 103 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/rtpdec: Make ff_rtp_handler_iterate() static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 14:03:22 2021 +0200| [3008a93b4deb4b453d908e90a651f17af578cf0d] | committer: Andreas Rheinhardt avformat/rtpdec: Make ff_rtp_handler_iterate() static Possible since 61974537610d82bd35b6e3ac91ccd270c6bdc711. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3008a93b4deb4b453d908e90a651f17af578cf0d --- libavformat/rtpdec.c | 15 --- libavformat/rtpdec.h | 10 -- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 6b0da9e636..20fe2b82d7 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -135,7 +135,16 @@ static const RTPDynamicProtocolHandler *const rtp_dynamic_protocol_handler_list[ NULL, }; -const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque) +/** + * Iterate over all registered rtp dynamic protocol handlers. + * + * @param opaque a pointer where libavformat will store the iteration state. + * Must point to NULL to start the iteration. + * + * @return the next registered rtp dynamic protocol handler + * or NULL when the iteration is finished + */ +static const RTPDynamicProtocolHandler *rtp_handler_iterate(void **opaque) { uintptr_t i = (uintptr_t)*opaque; const RTPDynamicProtocolHandler *r = rtp_dynamic_protocol_handler_list[i]; @@ -151,7 +160,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, { void *i = 0; const RTPDynamicProtocolHandler *handler; -while (handler = ff_rtp_handler_iterate()) { +while (handler = rtp_handler_iterate()) { if (handler->enc_name && !av_strcasecmp(name, handler->enc_name) && codec_type == handler->codec_type) @@ -165,7 +174,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, { void *i = 0; const RTPDynamicProtocolHandler *handler; -while (handler = ff_rtp_handler_iterate()) { +while (handler = rtp_handler_iterate()) { if (handler->static_payload_id && handler->static_payload_id == id && codec_type == handler->codec_type) return handler; diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index d54a05869f..5a02e72dc2 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -190,16 +190,6 @@ struct RTPDemuxContext { PayloadContext *dynamic_protocol_context; }; -/** - * Iterate over all registered rtp dynamic protocol handlers. - * - * @param opaque a pointer where libavformat will store the iteration state. Must - * point to NULL to start the iteration. - * - * @return the next registered rtp dynamic protocol handler or NULL when the iteration is - * finished - */ -const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque); /** * Find a registered rtp dynamic protocol handler with the specified name. * ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/iirfilter: Make ff_iir_filter_flt() static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 13:41:50 2021 +0200| [41751e4aefc5d1b12d45a3cbcc33d3d9b704609a] | committer: Andreas Rheinhardt avcodec/iirfilter: Make ff_iir_filter_flt() static Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41751e4aefc5d1b12d45a3cbcc33d3d9b704609a --- libavcodec/iirfilter.c | 21 - libavcodec/iirfilter.h | 16 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index cd5bbc943a..900893d2ff 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -287,10 +287,21 @@ void ff_iir_filter(const struct FFIIRFilterCoeffs *c, } } -void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c, - struct FFIIRFilterState *s, int size, - const float *src, ptrdiff_t sstep, - float *dst, ptrdiff_t dstep) +/** + * Perform IIR filtering on floating-point input samples. + * + * @param coeffs pointer to filter coefficients + * @param state pointer to filter state + * @param size input length + * @param srcsource samples + * @param sstep source stride + * @param dstfiltered samples (destination may be the same as input) + * @param dstep destination stride + */ +static void iir_filter_flt(const struct FFIIRFilterCoeffs *c, + struct FFIIRFilterState *s, int size, + const float *src, ptrdiff_t sstep, + float *dst, ptrdiff_t dstep) { if (c->order == 2) { FILTER_O2(float, FLT) @@ -317,7 +328,7 @@ av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp) } void ff_iir_filter_init(FFIIRFilterContext *f) { -f->filter_flt = ff_iir_filter_flt; +f->filter_flt = iir_filter_flt; if (HAVE_MIPSFPU) ff_iir_filter_init_mips(f); diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h index 5ffa1ce53a..d6b8fe2782 100644 --- a/libavcodec/iirfilter.h +++ b/libavcodec/iirfilter.h @@ -128,20 +128,4 @@ void ff_iir_filter_free_statep(struct FFIIRFilterState **state); void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, const int16_t *src, ptrdiff_t sstep, int16_t *dst, ptrdiff_t dstep); -/** - * Perform IIR filtering on floating-point input samples. - * - * @param coeffs pointer to filter coefficients - * @param state pointer to filter state - * @param size input length - * @param srcsource samples - * @param sstep source stride - * @param dstfiltered samples (destination may be the same as input) - * @param dstep destination stride - */ -void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *coeffs, - struct FFIIRFilterState *state, int size, - const float *src, ptrdiff_t sstep, - float *dst, ptrdiff_t dstep); - #endif /* AVCODEC_IIRFILTER_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/rawdec: Make ff_raw_data_read_header() static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 13:59:26 2021 +0200| [cd3d7b0f8f772883a0ab50918548e991750d5851] | committer: Andreas Rheinhardt avformat/rawdec: Make ff_raw_data_read_header() static Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd3d7b0f8f772883a0ab50918548e991750d5851 --- libavformat/rawdec.c | 4 ++-- libavformat/rawdec.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 06406424c8..b7e5a2d966 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -102,7 +102,7 @@ int ff_raw_subtitle_read_header(AVFormatContext *s) return 0; } -int ff_raw_data_read_header(AVFormatContext *s) +static int raw_data_read_header(AVFormatContext *s) { AVStream *st = avformat_new_stream(s, NULL); if (!st) @@ -148,7 +148,7 @@ const AVClass ff_raw_demuxer_class = { const AVInputFormat ff_data_demuxer = { .name = "data", .long_name = NULL_IF_CONFIG_SMALL("raw data"), -.read_header= ff_raw_data_read_header, +.read_header= raw_data_read_header, .read_packet= ff_raw_read_partial_packet, .raw_codec_id = AV_CODEC_ID_NONE, .flags = AVFMT_NOTIMESTAMPS, diff --git a/libavformat/rawdec.h b/libavformat/rawdec.h index 18777db290..f843fe5a2e 100644 --- a/libavformat/rawdec.h +++ b/libavformat/rawdec.h @@ -49,8 +49,6 @@ int ff_raw_video_read_header(AVFormatContext *s); int ff_raw_subtitle_read_header(AVFormatContext *s); -int ff_raw_data_read_header(AVFormatContext *s); - #define FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, flag)\ const AVInputFormat ff_ ## shortname ## _demuxer = {\ .name = #shortname,\ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/snow_dwt: Make ff_snow_(horizont|vertic)al_compose97i static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 13:38:05 2021 +0200| [854f7bab5a766d3b4530bb5fdd2c6b7e4faf5e02] | committer: Andreas Rheinhardt avcodec/snow_dwt: Make ff_snow_(horizont|vertic)al_compose97i static Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=854f7bab5a766d3b4530bb5fdd2c6b7e4faf5e02 --- libavcodec/snow_dwt.c | 16 libavcodec/snow_dwt.h | 4 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/libavcodec/snow_dwt.c b/libavcodec/snow_dwt.c index 25681e7edd..3dca3c6d30 100644 --- a/libavcodec/snow_dwt.c +++ b/libavcodec/snow_dwt.c @@ -462,7 +462,7 @@ static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, cs->y += 2; } -void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width) +static void snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width) { const int w2 = (width + 1) >> 1; int x; @@ -526,9 +526,9 @@ static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, b1[i] -= (W_DM * (b0[i] + b2[i]) + W_DO) >> W_DS; } -void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, - IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, - int width) +static void snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, + IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, + int width) { int i; @@ -625,9 +625,9 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, vertical_compose97iH0(b0, b1, b2, width); if (y - 1 < (unsigned)height) -ff_snow_horizontal_compose97i(b0, temp, width); +snow_horizontal_compose97i(b0, temp, width); if (y + 0 < (unsigned)height) -ff_snow_horizontal_compose97i(b1, temp, width); +snow_horizontal_compose97i(b1, temp, width); cs->b0 = b2; cs->b1 = b3; @@ -849,8 +849,8 @@ av_cold void ff_dsputil_init_dwt(MECmpContext *c) av_cold void ff_dwt_init(SnowDWTContext *c) { -c->vertical_compose97i = ff_snow_vertical_compose97i; -c->horizontal_compose97i = ff_snow_horizontal_compose97i; +c->vertical_compose97i = snow_vertical_compose97i; +c->horizontal_compose97i = snow_horizontal_compose97i; c->inner_add_yblock = ff_snow_inner_add_yblock; if (HAVE_MMX) diff --git a/libavcodec/snow_dwt.h b/libavcodec/snow_dwt.h index ee699de35e..390bc57130 100644 --- a/libavcodec/snow_dwt.h +++ b/libavcodec/snow_dwt.h @@ -99,10 +99,6 @@ void ff_slice_buffer_flush(slice_buffer *buf); void ff_slice_buffer_destroy(slice_buffer *buf); IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line); -void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, - IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, - int width); -void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width); void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t **block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer *sb, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov_chan: Make ff_mov_get_channel_layout() static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 13:52:06 2021 +0200| [49916dafb955d992160c4778b76099c848a35390] | committer: Andreas Rheinhardt avformat/mov_chan: Make ff_mov_get_channel_layout() static Possible since 3bab7cd12802dc5abf2c5cc6dec49e9e249ce204. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=49916dafb955d992160c4778b76099c848a35390 --- libavformat/mov_chan.c | 11 +-- libavformat/mov_chan.h | 9 - 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 4ec16f15c2..349634094c 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -451,7 +451,14 @@ static const struct { { AV_CODEC_ID_NONE,NULL}, }; -uint64_t ff_mov_get_channel_layout(uint32_t tag, uint32_t bitmap) +/** + * Get the channel layout for the specified channel layout tag. + * + * @param[in] tag channel layout tag + * @param[out] bitmap channel bitmap (only used if needed) + * @return channel layout + */ +static uint64_t mov_get_channel_layout(uint32_t tag, uint32_t bitmap) { int i, channels; const struct MovChannelLayoutMap *layout_map; @@ -591,7 +598,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, if (label_mask) st->codecpar->channel_layout = label_mask; } else -st->codecpar->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap); +st->codecpar->channel_layout = mov_get_channel_layout(layout_tag, bitmap); avio_skip(pb, size - 12); return 0; diff --git a/libavformat/mov_chan.h b/libavformat/mov_chan.h index 978b8a3732..f7916e9899 100644 --- a/libavformat/mov_chan.h +++ b/libavformat/mov_chan.h @@ -31,15 +31,6 @@ #include "libavcodec/codec_id.h" #include "avformat.h" -/** - * Get the channel layout for the specified channel layout tag. - * - * @param[in] tag channel layout tag - * @param[out] bitmap channel bitmap (only used if needed) - * @return channel layout - */ -uint64_t ff_mov_get_channel_layout(uint32_t tag, uint32_t bitmap); - /** * Get the channel layout tag for the specified codec id and channel layout. * If the layout tag was not found, use a channel bitmap if possible. ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/jpeg2000: Make ff_tag_tree_size() static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 13:30:11 2021 +0200| [faa62773cb944726440f2b6ea721086beaa09375] | committer: Andreas Rheinhardt avcodec/jpeg2000: Make ff_tag_tree_size() static Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=faa62773cb944726440f2b6ea721086beaa09375 --- libavcodec/jpeg2000.c | 8 libavcodec/jpeg2000.h | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c index 324908d833..2fbdb64280 100644 --- a/libavcodec/jpeg2000.c +++ b/libavcodec/jpeg2000.c @@ -39,8 +39,7 @@ /* tag tree routines */ -/* allocate the memory for tag tree */ -int32_t ff_tag_tree_size(int w, int h) +static int32_t tag_tree_size(int w, int h) { int64_t res = 0; while (w > 1 || h > 1) { @@ -52,13 +51,14 @@ int32_t ff_tag_tree_size(int w, int h) return (int32_t)(res + 1); } +/* allocate the memory for tag tree */ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int h) { int pw = w, ph = h; Jpeg2000TgtNode *res, *t, *t2; int32_t tt_size; -tt_size = ff_tag_tree_size(w, h); +tt_size = tag_tree_size(w, h); t = res = av_mallocz_array(tt_size, sizeof(*t)); if (!res) @@ -85,7 +85,7 @@ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int h) void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val) { -int i, siz = ff_tag_tree_size(w, h); +int i, siz = tag_tree_size(w, h); for (i = 0; i < siz; i++) { t[i].val = val; diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h index 612832c872..d06313425e 100644 --- a/libavcodec/jpeg2000.h +++ b/libavcodec/jpeg2000.h @@ -301,7 +301,6 @@ static inline int needs_termination(int style, int passno) { return 0; } -int32_t ff_tag_tree_size(int w, int h); void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val); #endif /* AVCODEC_JPEG2000_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mqcenc: Make ff_mqc_flush() static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 13:08:58 2021 +0200| [fc9cb7d51aa40bdbc0680278c4228701be445656] | committer: Andreas Rheinhardt avcodec/mqcenc: Make ff_mqc_flush() static Only used as an auxiliary function for ff_mqc_flush_to() since 4624656797b667eb6405186682eb04e74dfd90fd. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc9cb7d51aa40bdbc0680278c4228701be445656 --- libavcodec/mqc.h| 1 - libavcodec/mqcenc.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/mqc.h b/libavcodec/mqc.h index ad80fe9228..5e782b05f9 100644 --- a/libavcodec/mqc.h +++ b/libavcodec/mqc.h @@ -55,7 +55,6 @@ void ff_mqc_initenc(MqcState *mqc, uint8_t *bp); void ff_mqc_encode(MqcState *mqc, uint8_t *cxstate, int d); /** flush the encoder [returns number of bytes encoded] */ -int ff_mqc_flush(MqcState *mqc); int ff_mqc_flush_to(MqcState *mqc, uint8_t *dst, int *dst_len); /* decoder */ diff --git a/libavcodec/mqcenc.c b/libavcodec/mqcenc.c index c941f849d9..6d0368f827 100644 --- a/libavcodec/mqcenc.c +++ b/libavcodec/mqcenc.c @@ -102,7 +102,7 @@ void ff_mqc_encode(MqcState *mqc, uint8_t *cxstate, int d) } } -int ff_mqc_flush(MqcState *mqc) +static int mqc_flush(MqcState *mqc) { setbits(mqc); mqc->c = mqc->c << mqc->ct; @@ -120,7 +120,7 @@ int ff_mqc_flush_to(MqcState *mqc, uint8_t *dst, int *dst_len) mqc2.bpstart= mqc2.bp = dst; *mqc2.bp = *mqc->bp; -ff_mqc_flush(); +mqc_flush(); *dst_len = mqc2.bp - dst; if (mqc->bp < mqc->bpstart) { av_assert1(mqc->bpstart - mqc->bp == 1); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/h263dec: Make ff_h263_hw_config_list static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 12:41:29 2021 +0200| [029bfc3501dc4597c5438760db25bcacecdb5eb3] | committer: Andreas Rheinhardt avcodec/h263dec: Make ff_h263_hw_config_list static Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=029bfc3501dc4597c5438760db25bcacecdb5eb3 --- libavcodec/h263dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index b4aa109601..d7ae8a0727 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -742,7 +742,7 @@ const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = { AV_PIX_FMT_NONE }; -const AVCodecHWConfigInternal *const ff_h263_hw_config_list[] = { +static const AVCodecHWConfigInternal *const h263_hw_config_list[] = { #if CONFIG_H263_VAAPI_HWACCEL HWACCEL_VAAPI(h263), #endif @@ -773,7 +773,7 @@ const AVCodec ff_h263_decoder = { .flush = ff_mpeg_flush, .max_lowres = 3, .pix_fmts = ff_h263_hwaccel_pixfmt_list_420, -.hw_configs = ff_h263_hw_config_list, +.hw_configs = h263_hw_config_list, }; const AVCodec ff_h263p_decoder = { @@ -791,5 +791,5 @@ const AVCodec ff_h263p_decoder = { .flush = ff_mpeg_flush, .max_lowres = 3, .pix_fmts = ff_h263_hwaccel_pixfmt_list_420, -.hw_configs = ff_h263_hw_config_list, +.hw_configs = h263_hw_config_list, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/qsv: Make ff_qsv_map_error() static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 12:48:29 2021 +0200| [25394eb72ee0f0735ea06b439a8dde428def8dc3] | committer: Andreas Rheinhardt avcodec/qsv: Make ff_qsv_map_error() static It is only an auxiliary function to ff_qsv_print_(error|warning)(). Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=25394eb72ee0f0735ea06b439a8dde428def8dc3 --- libavcodec/qsv.c | 11 ++- libavcodec/qsv_internal.h | 5 - 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 139c4971de..2f332092a1 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -147,7 +147,10 @@ static const struct { { MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0, "incompatible audio parameters"}, }; -int ff_qsv_map_error(mfxStatus mfx_err, const char **desc) +/** + * Convert a libmfx error code into an FFmpeg error code. + */ +static int qsv_map_error(mfxStatus mfx_err, const char **desc) { int i; for (i = 0; i < FF_ARRAY_ELEMS(qsv_errors); i++) { @@ -166,8 +169,7 @@ int ff_qsv_print_error(void *log_ctx, mfxStatus err, const char *error_string) { const char *desc; -int ret; -ret = ff_qsv_map_error(err, ); +int ret = qsv_map_error(err, ); av_log(log_ctx, AV_LOG_ERROR, "%s: %s (%d)\n", error_string, desc, err); return ret; } @@ -176,8 +178,7 @@ int ff_qsv_print_warning(void *log_ctx, mfxStatus err, const char *warning_string) { const char *desc; -int ret; -ret = ff_qsv_map_error(err, ); +int ret = qsv_map_error(err, ); av_log(log_ctx, AV_LOG_WARNING, "%s: %s (%d)\n", warning_string, desc, err); return ret; } diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index 6b96c413c5..8090b748b3 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -106,11 +106,6 @@ typedef struct QSVFramesContext { int ff_qsv_print_iopattern(void *log_ctx, int mfx_iopattern, const char *extra_string); -/** - * Convert a libmfx error code into an ffmpeg error code. - */ -int ff_qsv_map_error(mfxStatus mfx_err, const char **desc); - int ff_qsv_print_error(void *log_ctx, mfxStatus err, const char *error_string); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/cbs: Make ff_cbs_alloc_unit_data() static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 12:37:26 2021 +0200| [fd43b868e1293b4d72323a861994f65456d060b6] | committer: Andreas Rheinhardt avcodec/cbs: Make ff_cbs_alloc_unit_data() static Forgotten in 7c92eaace2b338e0b3acc18e1543b365610578fd. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd43b868e1293b4d72323a861994f65456d060b6 --- libavcodec/cbs.c | 41 +++-- libavcodec/cbs.h | 9 - 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index f6e371ddef..d7aa67c3af 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -315,6 +315,28 @@ int ff_cbs_read(CodedBitstreamContext *ctx, data, size, 0); } +/** + * Allocate a new internal data buffer of the given size in the unit. + * + * The data buffer will have input padding. + */ +static int cbs_alloc_unit_data(CodedBitstreamUnit *unit, + size_t size) +{ +av_assert0(!unit->data && !unit->data_ref); + +unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); +if (!unit->data_ref) +return AVERROR(ENOMEM); + +unit->data = unit->data_ref->data; +unit->data_size = size; + +memset(unit->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); + +return 0; +} + static int cbs_write_unit_data(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { @@ -360,7 +382,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx, flush_put_bits(); -ret = ff_cbs_alloc_unit_data(unit, put_bytes_output()); +ret = cbs_alloc_unit_data(unit, put_bytes_output()); if (ret < 0) return ret; @@ -693,23 +715,6 @@ int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, return 0; } -int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit, - size_t size) -{ -av_assert0(!unit->data && !unit->data_ref); - -unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); -if (!unit->data_ref) -return AVERROR(ENOMEM); - -unit->data = unit->data_ref->data; -unit->data_size = size; - -memset(unit->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); - -return 0; -} - static int cbs_insert_unit(CodedBitstreamFragment *frag, int position) { diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h index bd97d163b1..87ea14cd07 100644 --- a/libavcodec/cbs.h +++ b/libavcodec/cbs.h @@ -380,15 +380,6 @@ int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit); - -/** - * Allocate a new internal data buffer of the given size in the unit. - * - * The data buffer will have input padding. - */ -int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit, - size_t size); - /** * Insert a new unit into a fragment with the given content. * ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/bsf: ff_list_bsf static
ffmpeg | branch: master | Andreas Rheinhardt | Mon Sep 6 12:15:42 2021 +0200| [97bc4695fb7a51574d863812af58ab63746558fd] | committer: Andreas Rheinhardt avcodec/bsf: ff_list_bsf static It is a special BSF that is only available via the av_bsf_list-API; it is not part of the list generated from the declarations in bitstream_filters.c and therefore needn't have external linkage. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=97bc4695fb7a51574d863812af58ab63746558fd --- libavcodec/bsf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 57034ce646..d9c8395260 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -394,7 +394,7 @@ static const AVClass bsf_list_class = { .version= LIBAVUTIL_VERSION_INT, }; -const AVBitStreamFilter ff_list_bsf = { +static const AVBitStreamFilter list_bsf = { .name = "bsf_list", .priv_data_size = sizeof(BSFListContext), .priv_class = _list_class, @@ -490,7 +490,7 @@ int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf) goto end; } -ret = av_bsf_alloc(_list_bsf, bsf); +ret = av_bsf_alloc(_bsf, bsf); if (ret < 0) return ret; @@ -544,5 +544,5 @@ end: int av_bsf_get_null_filter(AVBSFContext **bsf) { -return av_bsf_alloc(_list_bsf, bsf); +return av_bsf_alloc(_bsf, bsf); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] Changelog: update
ffmpeg | branch: release/4.4 | Michael Niedermayer | Wed Sep 8 23:14:28 2021 +0200| [b5cdf08cae1ae134b7409ec455bf09eb3432ad8e] | committer: Michael Niedermayer Changelog: update Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b5cdf08cae1ae134b7409ec455bf09eb3432ad8e --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index 9a57805c71..6b642e793a 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. version 4.4.1: +- avcodec/utils: don't return negative values in av_get_audio_frame_duration() - avcodec/jpeg2000dec: Check that atom header is within bytsetream - avcodec/apedec: Fix 2 integer overflows in filter_3800() - avcodec/xpmdec: Move allocations down after more error checks ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/utils: don't return negative values in av_get_audio_frame_duration()
ffmpeg | branch: release/4.4 | James Almer | Wed Jul 21 01:02:44 2021 -0300| [07dec5b0c383ebd6053bdf0a022dfe4aa01b9b70] | committer: Michael Niedermayer avcodec/utils: don't return negative values in av_get_audio_frame_duration() In some extrme cases, like with adpcm_ms samples with an extremely high channel count, get_audio_frame_duration() may return a negative frame duration value. Don't propagate it, and instead return 0, signaling that a duration could not be determined. Fixes ticket #9312 Signed-off-by: James Almer (cherry picked from commit e01d306c647b5827102260b885faa223b646d2d1) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=07dec5b0c383ebd6053bdf0a022dfe4aa01b9b70 --- libavcodec/utils.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index af121ff910..434004cccf 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -847,20 +847,22 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) { -return get_audio_frame_duration(avctx->codec_id, avctx->sample_rate, +int duration = get_audio_frame_duration(avctx->codec_id, avctx->sample_rate, avctx->channels, avctx->block_align, avctx->codec_tag, avctx->bits_per_coded_sample, avctx->bit_rate, avctx->extradata, avctx->frame_size, frame_bytes); +return FFMAX(0, duration); } int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes) { -return get_audio_frame_duration(par->codec_id, par->sample_rate, +int duration = get_audio_frame_duration(par->codec_id, par->sample_rate, par->channels, par->block_align, par->codec_tag, par->bits_per_coded_sample, par->bit_rate, par->extradata, par->frame_size, frame_bytes); +return FFMAX(0, duration); } #if !HAVE_THREADS ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/dhav: use frame number if timestamp difference is zero
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 22:46:01 2021 +0200| [7b523a06d0f4c006225c75339ce8f66b25a36f41] | committer: Paul B Mahol avformat/dhav: use frame number if timestamp difference is zero > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b523a06d0f4c006225c75339ce8f66b25a36f41 --- libavformat/dhav.c | 4 1 file changed, 4 insertions(+) diff --git a/libavformat/dhav.c b/libavformat/dhav.c index 92bbfab7c5..28c476d9c1 100644 --- a/libavformat/dhav.c +++ b/libavformat/dhav.c @@ -47,6 +47,7 @@ typedef struct DHAVContext { } DHAVContext; typedef struct DHAVStream { +int64_t last_frame_number; int64_t last_timestamp; int64_t last_time; int64_t pts; @@ -314,6 +315,8 @@ static int64_t get_pts(AVFormatContext *s, int stream_index) if (diff < 0) diff += 65535; +if (diff == 0) +diff = av_rescale(dhav->frame_number - dst->last_frame_number, 1000, dhav->frame_rate); dst->pts += diff; } else { dst->pts = t * 1000LL; @@ -321,6 +324,7 @@ static int64_t get_pts(AVFormatContext *s, int stream_index) dst->last_time = t; dst->last_timestamp = dhav->timestamp; +dst->last_frame_number = dhav->frame_number; return dst->pts; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] Update for 4.4.1
ffmpeg | branch: release/4.4 | Michael Niedermayer | Wed Sep 8 22:43:54 2021 +0200| [620fa723b8f797aabae67419ddc49b3577a00a64] | committer: Michael Niedermayer Update for 4.4.1 Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=620fa723b8f797aabae67419ddc49b3577a00a64 --- Changelog| 148 +++ RELEASE | 2 +- doc/Doxyfile | 2 +- 3 files changed, 150 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 214b3dbb4d..9a57805c71 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,154 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. +version 4.4.1: +- avcodec/jpeg2000dec: Check that atom header is within bytsetream +- avcodec/apedec: Fix 2 integer overflows in filter_3800() +- avcodec/xpmdec: Move allocations down after more error checks +- avcodec/argo: Move U, fix shift +- avformat/mov: Check dts for overflow in mov_read_trun() +- avformat/avidec: Use 64bit for frame number in odml index parsing +- avcodec/mjpegbdec: Skip SOS on AVDISCARD_ALL as does mjpeg +- avcodec/mjpegdec: Check for bits left in mjpeg_decode_scan_progressive_ac() +- avformat/adtsenc: return value check for init_get_bits in adts_decode_extradata +- avcodec/webp: Check available space in loop in decode_entropy_coded_image() +- avcodec/h264dec: use picture parameters in ff_print_debug_info2() +- avcodec/vc1dec: ff_print_debug_info() does not support WMV3 field_mode +- avcodec/frame_thread_encoder: Free AVCodecContext structure on error during init +- avcodec/faxcompr: Check for end of input in cmode == 1 in decode_group3_2d_line() +- avcodec/vc1dec: Disable error concealment for *IMAGE +- avcodec/sbrdsp_fixed: Fix negation overflow in sbr_neg_odd_64_c() +- avcodec/argo: Check for even dimensions +- avformat/wtvdec: Check for EOF before seeking back in parse_media_type() +- avformat/mpc8: Check first keyframe position for overflow +- avcodec/exr: Check ac_count +- avformat/wavdec: Use 64bit in new_pos computation +- avformat/sbgdec: Check for overflow in timestamp preparation +- avformat/dsicin: Check packet size for overflow +- avformat/dsfdec: Change order of operations in bitrate computation +- avformat/bfi: check nframes +- avformat/avidec: fix position overflow in avi_load_index() +- avformat/asfdec_f: Check sizeX against padding +- avformat/aiffdec: Check for size overflow in header parsing +- avcodec/aaccoder: Add minimal bias in search_for_ms() +- avformat/mov: Fix incorrect overflow detection in mov_read_sidx() +- avformat/mov: Avoid undefined overflow in time_offset calculation +- avfilter/af_drmeter: Check that there is data +- avfilter/vf_fftdnoiz: Use lrintf() in export_row8() +- avfilter/vf_mestimate: Check b_count +- avformat/mov: do not ignore errors in mov_metadata_hmmt() +- avformat/mxfdec: Check size for shrinking +- avcodec/dnxhddec: check and propagate function return value +- swscale/slice: Fix wrong return on error +- avcodec/aacdec_template: Avoid some invalid values to be set by decode_audio_specific_config_gb() +- swscale/slice: Check slice for allocation failure +- avformat/matroskadec: Fix handling of huge default durations +- avcodec/lpc: check for zero err in normalization in compute_lpc_coefs() +- avcodec/j2kenc: Check for av_strtok() failure +- avformat/ftp: Check for av_strtok() failure +- tools/cws2fws: Check read() for failure +- avcodec/cpia: Fix missing src_size update +- avcodec/exr: Better size checks +- avcodec/clearvideo: Check tile_size to be not too large +- avcodec/utils: Use 64bit for intermediate in AV_CODEC_ID_ADPCM_THP* duration calculation +- avformat/aaxdec: Check avio_seek() in header reading +- avcodec/hevc_sei: Use get_bits_long() for time_offset_value +- avformat/rmdec: Check old_format len for overflow +- avformat/realtextdec: Check the pts difference before using it for the duration computation +- avformat/qcp: Avoid negative nb_rates +- avformat/pp_bnk: Use 64bit in bitrate computation +- avformat/nutdec: Check tmp_size +- avformat/msf: Check that channels doesnt overflow during extradata construction +- avformat/subtitles: Check pts difference before use +- avformat/mpc8: Check for position overflow in mpc8_handle_chunk() +- avformat/mccdec: Fix overflows in num/den +- avformat/iff: Use 64bit in duration computation +- avformat/dxa: Check fps to be within the supported range more precissely +- avcodec/iff: Only write palette to plane 1 if its PAL8 +- avformat/tta: Check for EOF in index reading loop +- avfilter/vf_scale: set the RGB matrix coefficients in case of RGB +- avfilter/vf_scale: reset color matrix in case of identity & non-RGB +- ffmpeg: fix order between field order autodetection and override +- avcodec/h264_slice: clear old slice POC values on parsing failure +- avfilter/f_metadata: do not return the frame early if there is no metadata +- ffbuild:
[FFmpeg-cvslog] libavfilter/vf_scale_qsv: add MFX_MEMTYPE_FROM_VPPOUT flag to frame_type
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:09 2021 +0100| [c1cebaa4c495666ecd27f0dfe7f175e2f0185f7a] | committer: James Almer libavfilter/vf_scale_qsv: add MFX_MEMTYPE_FROM_VPPOUT flag to frame_type In case of DX11 device type, Media SDK is sensitive to these flags. Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c1cebaa4c495666ecd27f0dfe7f175e2f0185f7a --- libavfilter/vf_scale_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index fe8ed37418..2ab04457a9 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -202,7 +202,7 @@ static int init_out_pool(AVFilterContext *ctx, out_frames_ctx->sw_format = out_format; out_frames_ctx->initial_pool_size = 4; -out_frames_hwctx->frame_type = in_frames_hwctx->frame_type; +out_frames_hwctx->frame_type = in_frames_hwctx->frame_type | MFX_MEMTYPE_FROM_VPPOUT; ret = ff_filter_init_hw_frames(ctx, outlink, 32); if (ret < 0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavfilter/vf_scale_qsv: enabling d3d11va support, added mfxhdlpair
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:08 2021 +0100| [46c6946eeea8bb213c4f9b5b1f1aecfdfab5454e] | committer: James Almer libavfilter/vf_scale_qsv: enabling d3d11va support, added mfxhdlpair Adding DX11 relevant device type checks and adjusting callback with proper MediaSDK pair type support. Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46c6946eeea8bb213c4f9b5b1f1aecfdfab5454e --- libavfilter/vf_scale_qsv.c | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 2c9f8e153b..fe8ed37418 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -70,6 +70,7 @@ enum var_name { }; #define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19) +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) typedef struct QSVScaleContext { const AVClass *class; @@ -259,16 +260,16 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { -*hdl = mid; +mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; +mfxHDLPair *pair_src = (mfxHDLPair*)mid; + +pair_dst->first = pair_src->first; + +if (pair_src->second != (mfxMemId)MFX_INFINITE) +pair_dst->second = pair_src->second; return MFX_ERR_NONE; } -static const mfxHandleType handle_types[] = { -MFX_HANDLE_VA_DISPLAY, -MFX_HANDLE_D3D9_DEVICE_MANAGER, -MFX_HANDLE_D3D11_DEVICE, -}; - static int init_out_session(AVFilterContext *ctx) { @@ -300,14 +301,18 @@ static int init_out_session(AVFilterContext *ctx) return AVERROR_UNKNOWN; } -for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { -err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], ); -if (err == MFX_ERR_NONE) { -handle_type = handle_types[i]; -break; -} +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_VA_DISPLAY; +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D11_DEVICE; +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +} else { +av_log(ctx, AV_LOG_ERROR, "Error unsupported handle type\n"); +return AVERROR_UNKNOWN; } +err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, ); if (err < 0) return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle"); else if (err > 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavfilter/vf_deinterlace_qsv: enabling d3d11va support, added mfxhdlpair
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:10 2021 +0100| [19a17388d8c53acaeff0df59202254aa4038f6cb] | committer: James Almer libavfilter/vf_deinterlace_qsv: enabling d3d11va support, added mfxhdlpair Adding DX11 relevant device type checks and adjusting callback with proper MediaSDK pair type support. Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=19a17388d8c53acaeff0df59202254aa4038f6cb --- libavfilter/vf_deinterlace_qsv.c | 32 +++- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index ea0a9f4345..18b9a17760 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -42,6 +42,8 @@ #include "internal.h" #include "video.h" +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + enum { QSVDEINT_MORE_OUTPUT = 1, QSVDEINT_MORE_INPUT, @@ -144,16 +146,16 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { -*hdl = mid; +mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; +mfxHDLPair *pair_src = (mfxHDLPair*)mid; + +pair_dst->first = pair_src->first; + +if (pair_src->second != (mfxMemId)MFX_INFINITE) +pair_dst->second = pair_src->second; return MFX_ERR_NONE; } -static const mfxHandleType handle_types[] = { -MFX_HANDLE_VA_DISPLAY, -MFX_HANDLE_D3D9_DEVICE_MANAGER, -MFX_HANDLE_D3D11_DEVICE, -}; - static int init_out_session(AVFilterContext *ctx) { @@ -181,14 +183,18 @@ static int init_out_session(AVFilterContext *ctx) return AVERROR_UNKNOWN; } -for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { -err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], ); -if (err == MFX_ERR_NONE) { -handle_type = handle_types[i]; -break; -} +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_VA_DISPLAY; +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D11_DEVICE; +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +} else { +av_log(ctx, AV_LOG_ERROR, "Error unsupported handle type\n"); +return AVERROR_UNKNOWN; } +err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, ); if (err < 0) return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle"); else if (err > 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavfilter/qsvvpp: add MFX_MEMTYPE_FROM_VPPOUT flag to output frames
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:07 2021 +0100| [36166cc304975918da201de48987e9e898ae8021] | committer: James Almer libavfilter/qsvvpp: add MFX_MEMTYPE_FROM_VPPOUT flag to output frames In case of DX11 device type, Media SDK is sensitive to these flags. Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=36166cc304975918da201de48987e9e898ae8021 --- libavfilter/qsvvpp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 66b8673d4e..135d4c4e36 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -527,7 +527,7 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) s->out_mem_mode = IS_OPAQUE_MEMORY(s->in_mem_mode) ? MFX_MEMTYPE_OPAQUE_FRAME : - MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; + MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT; out_frames_ctx = (AVHWFramesContext *)out_frames_ref->data; out_frames_hwctx = out_frames_ctx->hwctx; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavfilter/qsvvpp: enabling d3d11va support, added mfxhdlpair
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:06 2021 +0100| [a611c35001f477f1c911027faa93cddf67874693] | committer: James Almer libavfilter/qsvvpp: enabling d3d11va support, added mfxhdlpair Adding DX11 relevant device type checks and adjusting callback with proper MediaSDK pair type support. Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a611c35001f477f1c911027faa93cddf67874693 --- libavfilter/qsvvpp.c | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index c7ef8a915f..66b8673d4e 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -36,12 +36,7 @@ MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET)) #define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME) #define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY) - -static const mfxHandleType handle_types[] = { -MFX_HANDLE_VA_DISPLAY, -MFX_HANDLE_D3D9_DEVICE_MANAGER, -MFX_HANDLE_D3D11_DEVICE, -}; +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) static const AVRational default_tb = { 1, 9 }; @@ -202,7 +197,13 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { -*hdl = mid; +mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; +mfxHDLPair *pair_src = (mfxHDLPair*)mid; + +pair_dst->first = pair_src->first; + +if (pair_src->second != (mfxMemId)MFX_INFINITE) +pair_dst->second = pair_src->second; return MFX_ERR_NONE; } @@ -572,14 +573,18 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) return AVERROR_UNKNOWN; } -for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { -ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], ); -if (ret == MFX_ERR_NONE) { -handle_type = handle_types[i]; -break; -} +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_VA_DISPLAY; +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D11_DEVICE; +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +} else { +av_log(avctx, AV_LOG_ERROR, "Error unsupported handle type\n"); +return AVERROR_UNKNOWN; } +ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, ); if (ret < 0) return ff_qsvvpp_print_error(avctx, ret, "Error getting the session handle"); else if (ret > 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavutil/hwcontext_d3d11va: adding more texture information to the D3D11 hwcontext API
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:05 2021 +0100| [4f78711f9c28b11dae4e4b96be46b6b4925eb8c6] | committer: James Almer libavutil/hwcontext_d3d11va: adding more texture information to the D3D11 hwcontext API Microsoft VideoProcessor requires texture with D3DUSAGE_RENDERTARGET flag as output. There is no way to allocate array of textures with D3D11_BIND_RENDER_TARGET flag and .ArraySize > 2 by ID3D11Device_CreateTexture2D due to the Microsoft limitation. Adding AVD3D11FrameDescriptors array to store array of single textures instead of texture with multiple slices resolves this. Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f78711f9c28b11dae4e4b96be46b6b4925eb8c6 --- doc/APIchanges| 3 +++ libavutil/hwcontext_d3d11va.c | 24 +++- libavutil/hwcontext_d3d11va.h | 9 + libavutil/hwcontext_qsv.c | 37 + libavutil/version.h | 4 ++-- 5 files changed, 58 insertions(+), 19 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 7a9aabc98e..d03e3233ba 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-09-08 - xx - lavu 57.5.100 - hwcontext_d3d11va.h + Add AVD3D11VAFramesContext.texture_infos + 2021-09-06 - xx - lsws 6.1.100 - swscale.h Add AVFrame-based scaling API: - sws_scale_frame() diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 27274ee3fa..272a19da47 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -72,6 +72,7 @@ static av_cold void load_functions(void) } typedef struct D3D11VAFramesContext { +int nb_surfaces; int nb_surfaces_used; DXGI_FORMAT format; @@ -112,6 +113,8 @@ static void d3d11va_frames_uninit(AVHWFramesContext *ctx) if (s->staging_texture) ID3D11Texture2D_Release(s->staging_texture); s->staging_texture = NULL; + +av_freep(_hwctx->texture_infos); } static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx, @@ -152,15 +155,21 @@ static void free_texture(void *opaque, uint8_t *data) av_free(data); } -static AVBufferRef *wrap_texture_buf(ID3D11Texture2D *tex, int index) +static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *tex, int index) { AVBufferRef *buf; -AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc)); +AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc)); +D3D11VAFramesContext *s = ctx->internal->priv; +AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx; if (!desc) { ID3D11Texture2D_Release(tex); return NULL; } +frames_hwctx->texture_infos[s->nb_surfaces_used].texture = tex; +frames_hwctx->texture_infos[s->nb_surfaces_used].index = index; +s->nb_surfaces_used++; + desc->texture = tex; desc->index = index; @@ -199,7 +208,7 @@ static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx) return NULL; } -return wrap_texture_buf(tex, 0); +return wrap_texture_buf(ctx, tex, 0); } static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size) @@ -220,7 +229,7 @@ static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size) } ID3D11Texture2D_AddRef(hwctx->texture); -return wrap_texture_buf(hwctx->texture, s->nb_surfaces_used++); +return wrap_texture_buf(ctx, hwctx->texture, s->nb_surfaces_used); } static int d3d11va_frames_init(AVHWFramesContext *ctx) @@ -267,7 +276,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) av_log(ctx, AV_LOG_ERROR, "User-provided texture has mismatching parameters\n"); return AVERROR(EINVAL); } -} else if (texDesc.ArraySize > 0) { +} else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && texDesc.ArraySize > 0) { hr = ID3D11Device_CreateTexture2D(device_hwctx->device, , NULL, >texture); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Could not create the texture (%lx)\n", (long)hr); @@ -275,6 +284,11 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) } } +hwctx->texture_infos = av_mallocz_array(ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); +if (!hwctx->texture_infos) +return AVERROR(ENOMEM); +s->nb_surfaces = ctx->initial_pool_size; + ctx->internal->pool_internal = av_buffer_pool_init2(sizeof(AVD3D11FrameDescriptor), ctx, d3d11va_pool_alloc, NULL); if (!ctx->internal->pool_internal) diff --git a/libavutil/hwcontext_d3d11va.h b/libavutil/hwcontext_d3d11va.h index 9f91e9b1b6..77d2d72f1b 100644 --- a/libavutil/hwcontext_d3d11va.h +++ b/libavutil/hwcontext_d3d11va.h @@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext { * This field is ignored/invalid if
[FFmpeg-cvslog] libavutil/hwcontext_qsv: add usage child_device_type argument to explicitly select d3d11va/DX11 device type
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:04 2021 +0100| [f1cd1dc6ce72e1d9ba259a946b3c033223f0a4f8] | committer: James Almer libavutil/hwcontext_qsv: add usage child_device_type argument to explicitly select d3d11va/DX11 device type UPD: Rebase of last patch set over current master and use DX9 as default device type. Makes selection of dxva2/DX9 device type by default as before with explicit d3d11va/DX11 usage to cover more HW configurations. Added warning message to expect changing default device type in the future. Fixes TGL / AV1 decode as requires DX11 with explicit DX11 type selection. Add headless/multi adapter support and fixes: https://trac.ffmpeg.org/ticket/7511 https://trac.ffmpeg.org/ticket/6827 http://ffmpeg.org/pipermail/ffmpeg-trac/2017-November/041901.html https://trac.ffmpeg.org/ticket/7933 https://github.com/InitialForce/FFmpeg/commit/338fbcd5bba1de0e1b3e3bad8985eee2fdfbeca1 https://github.com/jellyfin/jellyfin/issues/2626#issuecomment-602153952 Any other fixes are welcome including OpenCL interop patch since I don't have proper setup to validate this use case Decoding, encoding, transcoding have been validated. child_device_type option is responsible for d3d11va/dxva2 device selection Usage examples: DirectX 11: -init_hw_device qsv:hw,child_device_type=d3d11va -init_hw_device qsv:hw,child_device_type=d3d11va,child_device=0 OR -init_hw_device d3d11va=dx -init_hw_device qsv@dx DirectX 9 is still supported but requires explicit selection: -init_hw_device qsv:hw,child_device_type=dxva2 OR -init_hw_device dxva2=dx -init_hw_device qsv@dx Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1cd1dc6ce72e1d9ba259a946b3c033223f0a4f8 --- doc/ffmpeg.texi | 20 ++- libavutil/hwcontext_qsv.c | 62 +-- 2 files changed, 68 insertions(+), 14 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index c896aede3b..62d9703b7a 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1104,6 +1104,9 @@ device type: @item dxva2 @var{device} is the number of the Direct3D 9 display adapter. +@item d3d11va +@var{device} is the number of the Direct3D 11 display adapter. + @item vaapi @var{device} is either an X11 display name or a DRM render node. If not specified, it will attempt to open the default X11 display (@emph{$DISPLAY}) @@ -1127,9 +1130,21 @@ If not specified, it will attempt to open the default X11 display (@emph{$DISPLA @end table If not specified, @samp{auto_any} is used. (Note that it may be easier to achieve the desired result for QSV by creating the -platform-appropriate subdevice (@samp{dxva2} or @samp{vaapi}) and then deriving a +platform-appropriate subdevice (@samp{dxva2} or @samp{d3d11va} or @samp{vaapi}) and then deriving a QSV device from that.) +Alternatively, @samp{child_device_type} helps to choose platform-appropriate subdevice type. +On Windows @samp{d3d11va} is used as default subdevice type. + +Examples: +@table @emph +@item -init_hw_device qsv:hw,child_device_type=d3d11va +Choose the GPU subdevice with type @samp{d3d11va} and create QSV device with @samp{MFX_IMPL_HARDWARE}. + +@item -init_hw_device qsv:hw,child_device_type=dxva2 +Choose the GPU subdevice with type @samp{dxva2} and create QSV device with @samp{MFX_IMPL_HARDWARE}. +@end table + @item opencl @var{device} selects the platform and device as @emph{platform_index.device_index}. @@ -1232,6 +1247,9 @@ Use VDPAU (Video Decode and Presentation API for Unix) hardware acceleration. @item dxva2 Use DXVA2 (DirectX Video Acceleration) hardware acceleration. +@item d3d11va +Use D3D11VA (DirectX Video Acceleration) hardware acceleration. + @item vaapi Use VAAPI (Video Acceleration API) hardware acceleration. diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 0ca805e277..77b540fef9 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -1443,25 +1443,61 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, ctx->user_opaque = priv; ctx->free= qsv_device_free; -e = av_dict_get(opts, "child_device", NULL, 0); - -child_device_opts = NULL; -if (CONFIG_VAAPI) { +e = av_dict_get(opts, "child_device_type", NULL, 0); +if (e) { +child_device_type = av_hwdevice_find_type_by_name(e ? e->value : NULL); +if (child_device_type == AV_HWDEVICE_TYPE_NONE) { +av_log(ctx, AV_LOG_ERROR, "Unknown child device type " + "\"%s\".\n", e ? e->value : NULL); +return AVERROR(EINVAL); +} +} else if (CONFIG_VAAPI) { child_device_type = AV_HWDEVICE_TYPE_VAAPI; -// libmfx does not actually implement VAAPI properly, rather it -// depends on the specific behaviour of a matching iHD driver when -// used on recent Intel hardware. Set options to the
[FFmpeg-cvslog] libavutil/hwcontext_qsv: supporting d3d11va device type
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:03 2021 +0100| [a08a5299ac68b1151179c8b0ca1e920ee6c96e2b] | committer: James Almer libavutil/hwcontext_qsv: supporting d3d11va device type This enables usage of non-powered/headless GPU, better HDR support. Pool of resources is allocated as one texture with array of slices. Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a08a5299ac68b1151179c8b0ca1e920ee6c96e2b --- libavutil/hwcontext_qsv.c | 326 +- 1 file changed, 265 insertions(+), 61 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 08a6e0ee1c..0ca805e277 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -27,9 +27,13 @@ #include #endif +#define COBJMACROS #if CONFIG_VAAPI #include "hwcontext_vaapi.h" #endif +#if CONFIG_D3D11VA +#include "hwcontext_d3d11va.h" +#endif #if CONFIG_DXVA2 #include "hwcontext_dxva2.h" #endif @@ -48,6 +52,8 @@ (MFX_VERSION_MAJOR > (MAJOR) || \ MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)) +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + typedef struct QSVDevicePriv { AVBufferRef *child_device_ctx; } QSVDevicePriv; @@ -74,6 +80,7 @@ typedef struct QSVFramesContext { AVBufferRef *child_frames_ref; mfxFrameSurface1 *surfaces_internal; +mfxHDLPair *handle_pairs_internal; int nb_surfaces_used; // used in the frame allocator for non-opaque surfaces @@ -85,20 +92,6 @@ typedef struct QSVFramesContext { mfxExtBuffer *ext_buffers[1]; } QSVFramesContext; -static const struct { -mfxHandleType handle_type; -enum AVHWDeviceType device_type; -enum AVPixelFormat pix_fmt; -} supported_handle_types[] = { -#if CONFIG_VAAPI -{ MFX_HANDLE_VA_DISPLAY, AV_HWDEVICE_TYPE_VAAPI, AV_PIX_FMT_VAAPI }, -#endif -#if CONFIG_DXVA2 -{ MFX_HANDLE_D3D9_DEVICE_MANAGER, AV_HWDEVICE_TYPE_DXVA2, AV_PIX_FMT_DXVA2_VLD }, -#endif -{ 0 }, -}; - static const struct { enum AVPixelFormat pix_fmt; uint32_t fourcc; @@ -131,24 +124,11 @@ static int qsv_device_init(AVHWDeviceContext *ctx) { AVQSVDeviceContext *hwctx = ctx->hwctx; QSVDeviceContext *s = ctx->internal->priv; - +int hw_handle_supported = 0; +mfxHandleType handle_type; +enum AVHWDeviceType device_type; +enum AVPixelFormat pix_fmt; mfxStatus err; -int i; - -for (i = 0; supported_handle_types[i].handle_type; i++) { -err = MFXVideoCORE_GetHandle(hwctx->session, supported_handle_types[i].handle_type, - >handle); -if (err == MFX_ERR_NONE) { -s->handle_type = supported_handle_types[i].handle_type; -s->child_device_type = supported_handle_types[i].device_type; -s->child_pix_fmt = supported_handle_types[i].pix_fmt; -break; -} -} -if (!s->handle) { -av_log(ctx, AV_LOG_VERBOSE, "No supported hw handle could be retrieved " - "from the session\n"); -} err = MFXQueryIMPL(hwctx->session, >impl); if (err == MFX_ERR_NONE) @@ -158,6 +138,41 @@ static int qsv_device_init(AVHWDeviceContext *ctx) return AVERROR_UNKNOWN; } +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_VAAPI +handle_type = MFX_HANDLE_VA_DISPLAY; +device_type = AV_HWDEVICE_TYPE_VAAPI; +pix_fmt = AV_PIX_FMT_VAAPI; +hw_handle_supported = 1; +#endif +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_D3D11VA +handle_type = MFX_HANDLE_D3D11_DEVICE; +device_type = AV_HWDEVICE_TYPE_D3D11VA; +pix_fmt = AV_PIX_FMT_D3D11; +hw_handle_supported = 1; +#endif +} else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_DXVA2 +handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; +device_type = AV_HWDEVICE_TYPE_DXVA2; +pix_fmt = AV_PIX_FMT_DXVA2_VLD; +hw_handle_supported = 1; +#endif +} + +if (hw_handle_supported) { +err = MFXVideoCORE_GetHandle(hwctx->session, handle_type, >handle); +if (err == MFX_ERR_NONE) { +s->handle_type = handle_type; +s->child_device_type = device_type; +s->child_pix_fmt = pix_fmt; +} +} +if (!s->handle) { +av_log(ctx, AV_LOG_VERBOSE, "No supported hw handle could be retrieved " + "from the session\n"); +} return 0; } @@ -187,6 +202,7 @@ static void qsv_frames_uninit(AVHWFramesContext *ctx) av_freep(>mem_ids); av_freep(>surface_ptrs); av_freep(>surfaces_internal); +av_freep(>handle_pairs_internal); av_buffer_unref(>child_frames_ref); } @@ -202,6 +218,8 @@ static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size) if (s->nb_surfaces_used <
[FFmpeg-cvslog] libavcodec/qsv: enabling d3d11va support, added mfxhdlpair
ffmpeg | branch: master | Artem Galin | Fri Aug 20 22:48:02 2021 +0100| [776d5a747220b03810c7d7a02f1c41c800316799] | committer: James Almer libavcodec/qsv: enabling d3d11va support, added mfxhdlpair Adding DX11 relevant device type checks and adjusting callbacks with proper MediaSDK pair type support. Extending structure for proper MediaSDK pair type support. Signed-off-by: Artem Galin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=776d5a747220b03810c7d7a02f1c41c800316799 --- libavcodec/qsv.c | 53 --- libavcodec/qsv_internal.h | 2 +- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index c53e2e3b07..139c4971de 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -36,6 +36,8 @@ #include "avcodec.h" #include "qsv_internal.h" +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + #if QSV_VERSION_ATLEAST(1, 12) #include "mfx/mfxvp8.h" #endif @@ -230,7 +232,9 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame) int i; for (i = 0; i < ctx->nb_mids; i++) { QSVMid *mid = >mids[i]; -if (mid->handle == frame->surface.Data.MemId) +mfxHDLPair *pair = (mfxHDLPair*)frame->surface.Data.MemId; +if ((mid->handle_pair->first == pair->first) && +(mid->handle_pair->second == pair->second)) return i; } return AVERROR_BUG; @@ -370,7 +374,11 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs) int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, const char *load_plugins, int gpu_copy) { +#if CONFIG_D3D11VA +mfxIMPL impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11; +#else mfxIMPL impl = MFX_IMPL_AUTO_ANY; +#endif mfxVersionver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; mfxInitParam init_par = { MFX_IMPL_AUTO_ANY }; @@ -459,7 +467,7 @@ static AVBufferRef *qsv_create_mids(AVBufferRef *hw_frames_ref) for (i = 0; i < nb_surfaces; i++) { QSVMid *mid = [i]; -mid->handle= frames_hwctx->surfaces[i].Data.MemId; +mid->handle_pair = (mfxHDLPair*)frames_hwctx->surfaces[i].Data.MemId; mid->hw_frames_ref = hw_frames_ref1; } @@ -636,7 +644,7 @@ static mfxStatus qsv_frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) goto fail; qsv_mid->surf.Info = hw_frames_hwctx->surfaces[0].Info; -qsv_mid->surf.Data.MemId = qsv_mid->handle; +qsv_mid->surf.Data.MemId = qsv_mid->handle_pair; /* map the data to the system memory */ ret = av_hwframe_map(qsv_mid->locked_frame, qsv_mid->hw_frame, @@ -669,7 +677,13 @@ static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { QSVMid *qsv_mid = (QSVMid*)mid; -*hdl = qsv_mid->handle; +mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; +mfxHDLPair *pair_src = (mfxHDLPair*)qsv_mid->handle_pair; + +pair_dst->first = pair_src->first; + +if (pair_src->second != (mfxMemId)MFX_INFINITE) +pair_dst->second = pair_src->second; return MFX_ERR_NONE; } @@ -677,24 +691,19 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, AVBufferRef *device_ref, const char *load_plugins, int gpu_copy) { -static const mfxHandleType handle_types[] = { -MFX_HANDLE_VA_DISPLAY, -MFX_HANDLE_D3D9_DEVICE_MANAGER, -MFX_HANDLE_D3D11_DEVICE, -}; AVHWDeviceContext*device_ctx = (AVHWDeviceContext*)device_ref->data; AVQSVDeviceContext *device_hwctx = device_ctx->hwctx; mfxSessionparent_session = device_hwctx->session; mfxInitParaminit_par = { MFX_IMPL_AUTO_ANY }; mfxHDLhandle = NULL; +int hw_handle_supported = 0; mfxSessionsession; mfxVersionver; mfxIMPL impl; mfxHandleType handle_type; mfxStatus err; - -int i, ret; +int ret; err = MFXQueryIMPL(parent_session, ); if (err == MFX_ERR_NONE) @@ -703,13 +712,23 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, return ff_qsv_print_error(avctx, err, "Error querying the session attributes"); -for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { -err = MFXVideoCORE_GetHandle(parent_session, handle_types[i], ); -if (err == MFX_ERR_NONE) { -handle_type = handle_types[i]; -break; +if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_VA_DISPLAY; +hw_handle_supported = 1; +} else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { +handle_type = MFX_HANDLE_D3D11_DEVICE; +
[FFmpeg-cvslog] avfilter/af_speechnorm: add timeline support
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 22:11:06 2021 +0200| [3df55c7bd6c4a101b3baa7933415db016be63f45] | committer: Paul B Mahol avfilter/af_speechnorm: add timeline support > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3df55c7bd6c4a101b3baa7933415db016be63f45 --- libavfilter/af_speechnorm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_speechnorm.c b/libavfilter/af_speechnorm.c index fa56276e1d..35f8fe81a1 100644 --- a/libavfilter/af_speechnorm.c +++ b/libavfilter/af_speechnorm.c @@ -315,7 +315,7 @@ static void filter_channels_## name (AVFilterContext *ctx, av_assert0(size > 0); \ gain = cc->gain_state; \ consume_pi(cc, size); \ -for (int i = n; i < n + size; i++) \ +for (int i = n; !ctx->is_disabled && i < n + size; i++) \ dst[i] *= gain; \ n += size; \ } \ @@ -375,7 +375,7 @@ static void filter_link_channels_## name (AVFilterContext *ctx, if (cc->bypass) \ continue; \ \ -for (int i = n; i < n + min_size; i++) { \ +for (int i = n; !ctx->is_disabled && i < n + min_size; i++) { \ ptype g = tlerp(s->prev_gain, gain, (i - n) / (ptype)min_size); \ dst[i] *= g; \ } \ @@ -568,5 +568,6 @@ const AVFilter ff_af_speechnorm = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), +.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = process_command, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/af_speechnorm: check return value of av_frame_make_writable()
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 20:59:08 2021 +0200| [5db1e07a62e29da4c212a4a4536c570d06f3d102] | committer: Paul B Mahol avfilter/af_speechnorm: check return value of av_frame_make_writable() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5db1e07a62e29da4c212a4a4536c570d06f3d102 --- libavfilter/af_speechnorm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_speechnorm.c b/libavfilter/af_speechnorm.c index 0d1c6bd25d..fa56276e1d 100644 --- a/libavfilter/af_speechnorm.c +++ b/libavfilter/af_speechnorm.c @@ -410,7 +410,9 @@ static int filter_frame(AVFilterContext *ctx) in = ff_bufqueue_get(>queue); -av_frame_make_writable(in); +ret = av_frame_make_writable(in); +if (ret < 0) +return ret; s->filter_channels[s->link](ctx, in, in->nb_samples); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/af_speechnorm: use floats in place of doubles where it is already float used
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 20:52:38 2021 +0200| [ccd95cb248562a4ad7eeba0aa8aff992a1daa625] | committer: Paul B Mahol avfilter/af_speechnorm: use floats in place of doubles where it is already float used > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ccd95cb248562a4ad7eeba0aa8aff992a1daa625 --- libavfilter/af_speechnorm.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/libavfilter/af_speechnorm.c b/libavfilter/af_speechnorm.c index e94608fb41..0d1c6bd25d 100644 --- a/libavfilter/af_speechnorm.c +++ b/libavfilter/af_speechnorm.c @@ -236,7 +236,7 @@ static double min_gain(AVFilterContext *ctx, ChannelContext *cc, int max_size) return min_gain; } -#define ANALYZE_CHANNEL(name, ptype, zero) \ +#define ANALYZE_CHANNEL(name, ptype, zero, min_peak) \ static void analyze_channel_## name (AVFilterContext *ctx, ChannelContext *cc, \ const uint8_t *srcp, int nb_samples) \ { \ @@ -250,11 +250,11 @@ static void analyze_channel_## name (AVFilterContext *ctx, ChannelContext *cc, while (n < nb_samples) { \ if ((cc->state != (src[n] >= zero)) || \ (cc->pi[cc->pi_end].size > s->max_period)) { \ -double max_peak = cc->pi[cc->pi_end].max_peak; \ +ptype max_peak = cc->pi[cc->pi_end].max_peak; \ int state = cc->state; \ cc->state = src[n] >= zero; \ av_assert0(cc->pi[cc->pi_end].size > 0); \ -if (cc->pi[cc->pi_end].max_peak >= MIN_PEAK || \ +if (max_peak >= min_peak || \ cc->pi[cc->pi_end].size > s->max_period) { \ cc->pi[cc->pi_end].type = 1; \ cc->pi_end++; \ @@ -290,8 +290,8 @@ static void analyze_channel_## name (AVFilterContext *ctx, ChannelContext *cc, } \ } -ANALYZE_CHANNEL(dbl, double, 0.0) -ANALYZE_CHANNEL(flt, float, 0.f) +ANALYZE_CHANNEL(dbl, double, 0.0, MIN_PEAK) +ANALYZE_CHANNEL(flt, float, 0.f, (float)MIN_PEAK) #define FILTER_CHANNELS(name, ptype) \ static void filter_channels_## name (AVFilterContext *ctx, \ @@ -325,12 +325,17 @@ static void filter_channels_## name (AVFilterContext *ctx, FILTER_CHANNELS(dbl, double) FILTER_CHANNELS(flt, float) -static double lerp(double min, double max, double mix) +static double dlerp(double min, double max, double mix) { return min + (max - min) * mix; } -#define FILTER_LINK_CHANNELS(name, ptype) \ +static float flerp(float min, float max, float mix) +{ +return min + (max - min) * mix; +} + +#define FILTER_LINK_CHANNELS(name, ptype, tlerp) \ static void filter_link_channels_## name (AVFilterContext *ctx, \ AVFrame *in, int nb_samples) \ { \ @@ -371,7 +376,7 @@ static void filter_link_channels_## name (AVFilterContext *ctx, continue; \ \ for (int i = n; i < n + min_size; i++) { \ -ptype g = lerp(s->prev_gain, gain, (i - n) / (double)min_size); \ +ptype g = tlerp(s->prev_gain, gain, (i - n) / (ptype)min_size); \ dst[i] *= g; \ } \ } \ @@ -381,8 +386,8 @@ static void filter_link_channels_## name (AVFilterContext *ctx, } \ } -FILTER_LINK_CHANNELS(dbl, double) -FILTER_LINK_CHANNELS(flt, float) +FILTER_LINK_CHANNELS(dbl, double, dlerp) +FILTER_LINK_CHANNELS(flt, float,
[FFmpeg-cvslog] avcodec/jpeg2000dec: Check that atom header is within bytsetream
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Sep 5 21:00:38 2021 +0200| [b3e21be8e18b0304473a7b507a4545336cc658c4] | committer: Michael Niedermayer avcodec/jpeg2000dec: Check that atom header is within bytsetream Fixes: Infinite loop Fixes: 3/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5912760671141888 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 3c659f861856d751fe3aa1358b1cccff3117f948) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b3e21be8e18b0304473a7b507a4545336cc658c4 --- libavcodec/jpeg2000dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 63edbcda09..0d7ade5ce8 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -2361,6 +2361,8 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s) atom_size >= 16) { uint32_t atom2_size, atom2, atom2_end; do { +if (bytestream2_get_bytes_left(>g) < 8) +break; atom2_size = bytestream2_get_be32u(>g); atom2 = bytestream2_get_be32u(>g); atom2_end = bytestream2_tell(>g) + atom2_size - 8; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/apedec: Fix 2 integer overflows in filter_3800()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Sep 4 19:55:28 2021 +0200| [7d58def70a530d0693bc0a9762db7c544553b256] | committer: Michael Niedermayer avcodec/apedec: Fix 2 integer overflows in filter_3800() Fixes: signed integer overflow: 1683879955 - -466265224 cannot be represented in type 'int' Fixes: 37419/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6074294407921664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 33feb527fff9bf547c4118147434869875cf0c3d) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d58def70a530d0693bc0a9762db7c544553b256 --- libavcodec/apedec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index e0c6b6bb8b..6df958eed6 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -909,8 +909,8 @@ static av_always_inline int filter_3800(APEPredictor *p, return predictionA; } d2 = p->buf[delayA]; -d1 = (p->buf[delayA] - p->buf[delayA - 1]) * 2U; -d0 = p->buf[delayA] + ((p->buf[delayA - 2] - p->buf[delayA - 1]) * 8U); +d1 = (p->buf[delayA] - (unsigned)p->buf[delayA - 1]) * 2; +d0 = p->buf[delayA] + ((p->buf[delayA - 2] - (unsigned)p->buf[delayA - 1]) * 8); d3 = p->buf[delayB] * 2U - p->buf[delayB - 1]; d4 = p->buf[delayB]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/xpmdec: Move allocations down after more error checks
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Sep 3 18:54:08 2021 +0200| [baefa5385e312bf8283880863f963f3a8fb7df02] | committer: Michael Niedermayer avcodec/xpmdec: Move allocations down after more error checks Fixes: Timeout Fixes: 37035/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XPM_fuzzer-5142718576721920 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit e58692837c20c8484a23cd9beb63ac422f82458a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=baefa5385e312bf8283880863f963f3a8fb7df02 --- libavcodec/xpmdec.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 922dfc0f67..993873c595 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -341,9 +341,6 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_set_dimensions(avctx, width, height)) < 0) return ret; -if ((ret = ff_get_buffer(avctx, p, 0)) < 0) -return ret; - if (cpp <= 0 || cpp >= 5) { av_log(avctx, AV_LOG_ERROR, "unsupported/invalid number of chars per pixel: %d\n", cpp); return AVERROR_INVALIDDATA; @@ -360,14 +357,17 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, size *= 4; -av_fast_padded_malloc(>pixels, >pixels_size, size); -if (!x->pixels) -return AVERROR(ENOMEM); - ptr += mod_strcspn(ptr, ",") + 1; if (end - ptr < 1) return AVERROR_INVALIDDATA; +if ((ret = ff_get_buffer(avctx, p, 0)) < 0) +return ret; + +av_fast_padded_malloc(>pixels, >pixels_size, size); +if (!x->pixels) +return AVERROR(ENOMEM); + for (i = 0; i < ncolors; i++) { const uint8_t *index; int len; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/argo: Move U, fix shift
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Sep 3 17:12:53 2021 +0200| [34aad0245725ac91a62c4ce45474b4f8b452e303] | committer: Michael Niedermayer avcodec/argo: Move U, fix shift Fixes: left shift of 255 by 24 places cannot be represented in type 'int' Fixes: 37249/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARGO_fuzzer-5754862984888320 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 26659fe53ee9e51dc06ea2384321cc18229f5768) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34aad0245725ac91a62c4ce45474b4f8b452e303 --- libavcodec/argo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/argo.c b/libavcodec/argo.c index 7074561956..f633ec2691 100644 --- a/libavcodec/argo.c +++ b/libavcodec/argo.c @@ -59,7 +59,7 @@ static int decode_pal8(AVCodecContext *avctx, uint32_t *pal) return AVERROR_INVALIDDATA; for (int i = 0; i < count; i++) -pal[start + i] = (0xFF << 24U) | bytestream2_get_be24u(gb); +pal[start + i] = (0xFFU << 24) | bytestream2_get_be24u(gb); return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov: Check dts for overflow in mov_read_trun()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Thu Aug 26 13:37:27 2021 +0200| [3d5f361290abcc16f6b003bab6ad84ad05aad2b0] | committer: Michael Niedermayer avformat/mov: Check dts for overflow in mov_read_trun() Fixes: signed integer overflow: 9223372034248226491 + 3275247799 cannot be represented in type 'long' Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-4538729166077952 Reported-by: Matt Wolenetz Signed-off-by: Michael Niedermayer (cherry picked from commit 4de4bc06fdfd0383f3d9012c6557a38408a09d28) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3d5f361290abcc16f6b003bab6ad84ad05aad2b0 --- libavformat/mov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index b49dd01543..a7a31dada1 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4992,6 +4992,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) "size %u, distance %d, keyframe %d\n", st->index, index_entry_pos, offset, dts, sample_size, distance, keyframe); distance++; +if (av_sat_add64(dts, sample_duration) != dts + (uint64_t)sample_duration) +return AVERROR_INVALIDDATA; dts += sample_duration; offset += sample_size; sc->data_size += sample_size; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/adtsenc: return value check for init_get_bits in adts_decode_extradata
ffmpeg | branch: release/4.4 | maryam ebrahimzadeh | Wed Aug 4 16:15:18 2021 -0400| [fb993619d1035fa9646506925ea70fb122038999] | committer: Michael Niedermayer avformat/adtsenc: return value check for init_get_bits in adts_decode_extradata As the second argument for init_get_bits (buf) can be crafted, a return value check for this function call is necessary. 'buf' is part of 'AVPacket pkt'. replace init_get_bits with init_get_bits8. Signed-off-by: Michael Niedermayer (cherry picked from commit 9ffa49496d1aae4cbbb387aac28a9e061a6ab0a6) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb993619d1035fa9646506925ea70fb122038999 --- libavformat/adtsenc.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 3595cb3bb2..c35a12a628 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -51,9 +51,11 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui GetBitContext gb; PutBitContext pb; MPEG4AudioConfig m4ac; -int off; +int off, ret; -init_get_bits(, buf, size * 8); +ret = init_get_bits8(, buf, size); +if (ret < 0) +return ret; off = avpriv_mpeg4audio_get_config2(, buf, size, 1, s); if (off < 0) return off; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/avidec: Use 64bit for frame number in odml index parsing
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue May 11 18:54:53 2021 +0200| [e64b4a75bdb4dd32a6478ffeca649882e3804956] | committer: Michael Niedermayer avformat/avidec: Use 64bit for frame number in odml index parsing Fixes: signed integer overflow: 1179337772 + 1392508928 cannot be represented in type 'int' Fixes: 34088/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-5846945303232512 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit a4c98c507ed3c729fc92d641b974385f8aa37b33) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e64b4a75bdb4dd32a6478ffeca649882e3804956 --- libavformat/avidec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 079f2dbf8a..174ac25db2 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -165,7 +165,7 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) return 0; } -static int read_odml_index(AVFormatContext *s, int frame_num) +static int read_odml_index(AVFormatContext *s, int64_t frame_num) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; @@ -185,7 +185,7 @@ static int read_odml_index(AVFormatContext *s, int frame_num) av_log(s, AV_LOG_TRACE, "longs_per_entry:%d index_type:%d entries_in_use:%d " -"chunk_id:%X base:%16"PRIX64" frame_num:%d\n", +"chunk_id:%X base:%16"PRIX64" frame_num:%"PRId64"\n", longs_per_entry, index_type, entries_in_use, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mjpegbdec: Skip SOS on AVDISCARD_ALL as does mjpeg
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Aug 22 21:57:28 2021 +0200| [fa4ac6b43a48f6cb047792fed349bc1ea6952c36] | committer: Michael Niedermayer avcodec/mjpegbdec: Skip SOS on AVDISCARD_ALL as does mjpeg Fixes: NULL pointer dereference Fixes: 36342/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-4579188072906752 Fixes: 36344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-5049579300061184 Fixes: 36345/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-5301149845553152 Fixes: 36374/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-6056312352931840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 104a8399ae96f022a3662bd67668ad07e53e3093) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa4ac6b43a48f6cb047792fed349bc1ea6952c36 --- libavcodec/mjpegbdec.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c index 774908..19875a2ddb 100644 --- a/libavcodec/mjpegbdec.c +++ b/libavcodec/mjpegbdec.c @@ -119,9 +119,13 @@ read_header: 8 * FFMIN(field_size, buf_end - buf_ptr - sos_offs)); s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(>gb, 16)); s->start_code = SOS; -ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL); -if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) -return ret; +if (avctx->skip_frame == AVDISCARD_ALL) { +skip_bits(>gb, get_bits_left(>gb)); +} else { +ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL); +if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) +return ret; +} } if (s->interlaced) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/webp: Check available space in loop in decode_entropy_coded_image()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Jul 25 15:50:54 2021 +0200| [671e182cc46e73a0b63c3d1f35efab12405f8ea5] | committer: Michael Niedermayer avcodec/webp: Check available space in loop in decode_entropy_coded_image() Fixes: Timeout Fixes: 35401/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WEBP_fuzzer-5714401821851648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 5e00eab61112c52f27a09fe77d50e6fc508f9c53) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=671e182cc46e73a0b63c3d1f35efab12405f8ea5 --- libavcodec/webp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 5a7aebc587..06a4cc04a5 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -627,6 +627,9 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role, while (y < img->frame->height) { int v; +if (get_bits_left(>gb) < 0) +return AVERROR_INVALIDDATA; + hg = get_huffman_group(s, img, x, y); v = huff_reader_get_symbol([HUFF_IDX_GREEN], >gb); if (v < NUM_LITERAL_CODES) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mjpegdec: Check for bits left in mjpeg_decode_scan_progressive_ac()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Aug 22 20:47:00 2021 +0200| [af8de920b7bdf6f5dfb34d3fd2e31e24fe50fb60] | committer: Michael Niedermayer avcodec/mjpegdec: Check for bits left in mjpeg_decode_scan_progressive_ac() Fixes: Timeout Fixes: 36262/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-4969052454912000 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 909faca929cf30dcd439fa33479177e76fb5121d) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af8de920b7bdf6f5dfb34d3fd2e31e24fe50fb60 --- libavcodec/mjpegdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 2df6caa440..afb117cfc6 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1573,6 +1573,9 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, else ret = decode_block_progressive(s, *block, last_nnz, s->ac_index[0], quant_matrix, ss, se, Al, ); + +if (ret >= 0 && get_bits_left(>gb) < 0) +ret = AVERROR_INVALIDDATA; if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/h264dec: use picture parameters in ff_print_debug_info2()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Aug 8 21:23:31 2021 +0200| [fa6d6cc810002b73107420480a07c9e982087d45] | committer: Michael Niedermayer avcodec/h264dec: use picture parameters in ff_print_debug_info2() Fixes: out of array read Fixes: 36341/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6737583085322240 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 65892516d52c268bd66ef825c4b1c8050a69d732) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa6d6cc810002b73107420480a07c9e982087d45 --- libavcodec/h264dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 47b9abbc5c..485f47d36e 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -914,7 +914,7 @@ static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *g out->qscale_table, out->motion_val, NULL, - h->mb_width, h->mb_height, h->mb_stride, 1); + out->mb_width, out->mb_height, out->mb_stride, 1); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vc1dec: ff_print_debug_info() does not support WMV3 field_mode
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Aug 8 20:46:32 2021 +0200| [82fe7775a8cd59f2a576b11db38ff9515c04bd1e] | committer: Michael Niedermayer avcodec/vc1dec: ff_print_debug_info() does not support WMV3 field_mode Fixes: out of array read Fixes: 36331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-5140494328922112.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit c59b5e3d1e0121ea23b5b326529f5bdca44cf982) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82fe7775a8cd59f2a576b11db38ff9515c04bd1e --- libavcodec/vc1dec.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index d822240cff..d4ceb60791 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1154,12 +1154,14 @@ image: if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) goto err; -ff_print_debug_info(s, s->current_picture_ptr, pict); +if (!v->field_mode) +ff_print_debug_info(s, s->current_picture_ptr, pict); *got_frame = 1; } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) goto err; -ff_print_debug_info(s, s->last_picture_ptr, pict); +if (!v->field_mode) +ff_print_debug_info(s, s->last_picture_ptr, pict); *got_frame = 1; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/frame_thread_encoder: Free AVCodecContext structure on error during init
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Aug 14 09:55:00 2021 +0200| [4254dbe20fea3e3e1897c82027f148c868d6c11e] | committer: Michael Niedermayer avcodec/frame_thread_encoder: Free AVCodecContext structure on error during init Fixes: MemLeak Fixes: 8281 Fixes: PoC_option158.jpg Fixes: CVE-2020-22037 Reviewed-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer (cherry picked from commit 7bba0dd6382e30d646cb406034a66199e071d713) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4254dbe20fea3e3e1897c82027f148c868d6c11e --- libavcodec/frame_thread_encoder.c | 11 +++ libavcodec/frame_thread_encoder.h | 4 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c index 778317d60b..0d52f066e5 100644 --- a/libavcodec/frame_thread_encoder.c +++ b/libavcodec/frame_thread_encoder.c @@ -124,7 +124,7 @@ end: int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){ int i=0; ThreadContext *c; - +AVCodecContext *thread_avctx = NULL; if( !(avctx->thread_type & FF_THREAD_FRAME) || !(avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)) @@ -205,16 +205,17 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){ AVDictionary *tmp = NULL; int ret; void *tmpv; -AVCodecContext *thread_avctx = avcodec_alloc_context3(avctx->codec); +thread_avctx = avcodec_alloc_context3(avctx->codec); if(!thread_avctx) goto fail; tmpv = thread_avctx->priv_data; *thread_avctx = *avctx; +thread_avctx->priv_data = tmpv; +thread_avctx->internal = NULL; +thread_avctx->hw_frames_ctx = NULL; ret = av_opt_copy(thread_avctx, avctx); if (ret < 0) goto fail; -thread_avctx->priv_data = tmpv; -thread_avctx->internal = NULL; if (avctx->codec->priv_class) { int ret = av_opt_copy(thread_avctx->priv_data, avctx->priv_data); if (ret < 0) @@ -243,6 +244,8 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){ return 0; fail: +avcodec_close(thread_avctx); +av_freep(_avctx); avctx->thread_count = i; av_log(avctx, AV_LOG_ERROR, "ff_frame_thread_encoder_init failed\n"); ff_frame_thread_encoder_free(avctx); diff --git a/libavcodec/frame_thread_encoder.h b/libavcodec/frame_thread_encoder.h index c400d6b32c..9733fcdc2d 100644 --- a/libavcodec/frame_thread_encoder.h +++ b/libavcodec/frame_thread_encoder.h @@ -23,6 +23,10 @@ #include "avcodec.h" +/** + * Initialize frame thread encoder. + * @note hardware encoders are not supported + */ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options); void ff_frame_thread_encoder_free(AVCodecContext *avctx); int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/faxcompr: Check for end of input in cmode == 1 in decode_group3_2d_line()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Jul 31 21:17:23 2021 +0200| [f6f682f5aac684e3579553dc3981746623ac3f6e] | committer: Michael Niedermayer avcodec/faxcompr: Check for end of input in cmode == 1 in decode_group3_2d_line() Fixes: Infinite loop Fixes: 35591/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4503764022198272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit f803635c4fac761ac68b39a369272d4c26433dc1) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f6f682f5aac684e3579553dc3981746623ac3f6e --- libavcodec/faxcompr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c index 44c1f6f6b9..b283831dae 100644 --- a/libavcodec/faxcompr.c +++ b/libavcodec/faxcompr.c @@ -283,6 +283,8 @@ static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb, for (k = 0; k < 2; k++) { run = 0; for (;;) { +if (get_bits_left(gb) <= 0) +return AVERROR_INVALIDDATA; t = get_vlc2(gb, ccitt_vlc[mode].table, 9, 2); if (t == -1) { av_log(avctx, AV_LOG_ERROR, "Incorrect code\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vc1dec: Disable error concealment for *IMAGE
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Jul 31 00:01:53 2021 +0200| [674adf0a028bb795dd089ff0ce8d83aedde93f72] | committer: Michael Niedermayer avcodec/vc1dec: Disable error concealment for *IMAGE The existing error concealment makes no sense for the image formats, they use transformed source images which is different from keyframe + MC+difference for which the error concealment is designed. Of course feel free to re-enable this if you have a case where it works and improves vissual results Fixes: Timeout Fixes: 36234/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-6300306743885824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 643b2d49bf52d5a3205ce3db732e0c4c396bd457) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=674adf0a028bb795dd089ff0ce8d83aedde93f72 --- libavcodec/vc1dec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index ea93e11588..d822240cff 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1124,7 +1124,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, ret = AVERROR_INVALIDDATA; goto err; } -if (!v->field_mode) +if ( !v->field_mode +&& avctx->codec_id != AV_CODEC_ID_WMV3IMAGE +&& avctx->codec_id != AV_CODEC_ID_VC1IMAGE) ff_er_frame_end(>er); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/sbrdsp_fixed: Fix negation overflow in sbr_neg_odd_64_c()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Jul 30 23:04:08 2021 +0200| [f25834ab0786308824bd4b4a082dfaeda0384449] | committer: Michael Niedermayer avcodec/sbrdsp_fixed: Fix negation overflow in sbr_neg_odd_64_c() Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 35593/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5182217725804544 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 8f2856a1daa4e3d5767b6efe7a70ec86926dba47) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f25834ab0786308824bd4b4a082dfaeda0384449 --- libavcodec/sbrdsp_fixed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sbrdsp_fixed.c b/libavcodec/sbrdsp_fixed.c index 91fa664c08..43fcc90ae5 100644 --- a/libavcodec/sbrdsp_fixed.c +++ b/libavcodec/sbrdsp_fixed.c @@ -87,7 +87,7 @@ static void sbr_neg_odd_64_c(int *x) { int i; for (i = 1; i < 64; i += 2) -x[i] = -x[i]; +x[i] = -(unsigned)x[i]; } static void sbr_qmf_pre_shuffle_c(int *z) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/argo: Check for even dimensions
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Jul 31 12:41:34 2021 +0200| [725a0446b409d20a8fb762e5804b170808a52001] | committer: Michael Niedermayer avcodec/argo: Check for even dimensions Fixes: reading over the end Fixes: 36346/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARGO_fuzzer-5366943107383296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit c2f5e9ff3c8141fe6a2c08f3cc4e46e17b96cbb4) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=725a0446b409d20a8fb762e5804b170808a52001 --- libavcodec/argo.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/argo.c b/libavcodec/argo.c index 7358d102e3..7074561956 100644 --- a/libavcodec/argo.c +++ b/libavcodec/argo.c @@ -685,6 +685,11 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_PATCHWELCOME; } +if (avctx->width % 2 || avctx->height % 2) { +avpriv_request_sample(s, "Odd dimensions\n"); +return AVERROR_PATCHWELCOME; +} + s->frame = av_frame_alloc(); if (!s->frame) return AVERROR(ENOMEM); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/wtvdec: Check for EOF before seeking back in parse_media_type()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Aug 1 20:42:53 2021 +0200| [88264f84c99519651a7417f4eed25ae17a6e61d1] | committer: Michael Niedermayer avformat/wtvdec: Check for EOF before seeking back in parse_media_type() Fixes: Infinite loop Fixes: 36311/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-4889181296918528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross Signed-off-by: Michael Niedermayer (cherry picked from commit 89505d38de989bddd579ce3b841f1c011f1d7bf2) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=88264f84c99519651a7417f4eed25ae17a6e61d1 --- libavformat/wtvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 876256676c..1d5ba03bef 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -660,6 +660,8 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, avio_skip(pb, size - 32); ff_get_guid(pb, _subtype); ff_get_guid(pb, _formattype); +if (avio_feof(pb)) +return NULL; avio_seek(pb, -size, SEEK_CUR); st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mpc8: Check first keyframe position for overflow
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Aug 1 20:25:20 2021 +0200| [58477f42a2a7220bf412fbfd460c6fcc077396a5] | committer: Michael Niedermayer avformat/mpc8: Check first keyframe position for overflow Fixes: signed integer overflow: 9223372036854775791 + 18 cannot be represented in type 'long' Fixes: 36307/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-4917863877050368 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 2bbef69b0ba938cce4f9d61bed46d3f3058e56c2) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58477f42a2a7220bf412fbfd460c6fcc077396a5 --- libavformat/mpc8.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 95813df748..c3d7e115a7 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -177,7 +177,13 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) } seekd = get_bits(, 4); for(i = 0; i < 2; i++){ -pos = gb_get_v() + c->header_pos; +pos = gb_get_v(); +if (av_sat_add64(pos, c->header_pos) != pos + (uint64_t)c->header_pos) { +av_free(buf); +return; +} + +pos += c->header_pos; ppos[1 - i] = pos; av_add_index_entry(s->streams[0], pos, i, 0, 0, AVINDEX_KEYFRAME); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/exr: Check ac_count
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Aug 1 18:38:31 2021 +0200| [fbf576417aa7701fad87d27c998ab0fe2ec6ba84] | committer: Michael Niedermayer avcodec/exr: Check ac_count Fixes: signed integer overflow: -9223372036854775808 * 2 cannot be represented in type 'long long' Fixes: 36244/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6090656186499072 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 9bc32d7c4bed836086199ce55cf4a5ddd5217f3e) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fbf576417aa7701fad87d27c998ab0fe2ec6ba84 --- libavcodec/exr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 27c243c12c..21b3b179ab 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1014,7 +1014,9 @@ static int dwa_uncompress(EXRContext *s, const uint8_t *src, int compressed_size dc_count = AV_RL64(src + 72); ac_compression = AV_RL64(src + 80); -if (compressed_size < (uint64_t)(lo_size | ac_size | dc_size | rle_csize) || compressed_size < 88LL + lo_size + ac_size + dc_size + rle_csize) +if ( compressed_size < (uint64_t)(lo_size | ac_size | dc_size | rle_csize) || compressed_size < 88LL + lo_size + ac_size + dc_size + rle_csize +|| ac_count > (uint64_t)INT_MAX/2 +) return AVERROR_INVALIDDATA; bytestream2_init(, src + 88, compressed_size - 88); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/wavdec: Use 64bit in new_pos computation
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue Apr 27 20:57:02 2021 +0200| [8a3eb4498b10d16fb973443826bffd117ad9e7c6] | committer: Michael Niedermayer avformat/wavdec: Use 64bit in new_pos computation Fixes: signed integer overflow: 129 * 16711680 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6742285317439488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 9b57d2f0a967195dc1c72fda8f3a983a0132a243) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a3eb4498b10d16fb973443826bffd117ad9e7c6 --- libavformat/wavdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 8214ab8498..212d198e99 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -718,7 +718,7 @@ smv_retry: if (wav->smv_last_stream) { uint64_t old_pos = avio_tell(s->pb); uint64_t new_pos = wav->smv_data_ofs + -wav->smv_block * wav->smv_block_size; +wav->smv_block * (int64_t)wav->smv_block_size; if (avio_seek(s->pb, new_pos, SEEK_SET) < 0) { ret = AVERROR_EOF; goto smv_out; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/sbgdec: Check for overflow in timestamp preparation
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue Apr 27 20:53:32 2021 +0200| [3a18a6acc4b3cd60d2cf2af946f1a11af7c4600b] | committer: Michael Niedermayer avformat/sbgdec: Check for overflow in timestamp preparation Fixes: signed integer overflow: 9223372036854775807 + 864 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6731040263634944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 9dbed908403b0d97ae70881fab68020f148b6b11) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3a18a6acc4b3cd60d2cf2af946f1a11af7c4600b --- libavformat/sbgdec.c | 4 1 file changed, 4 insertions(+) diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c index 83016d0c13..9530ea42a5 100644 --- a/libavformat/sbgdec.c +++ b/libavformat/sbgdec.c @@ -1291,6 +1291,10 @@ static int generate_intervals(void *log, struct sbg_script *s, int sample_rate, ev1 = >events[i]; ev2 = >events[(i + 1) % s->nb_events]; ev1->ts_int = ev1->ts; + +if (!ev1->fade.slide && ev1 >= ev2 && ev2->ts > INT64_MAX - period) +return AVERROR_INVALIDDATA; + ev1->ts_trans = ev1->fade.slide ? ev1->ts : ev2->ts + (ev1 < ev2 ? 0 : period); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/dsicin: Check packet size for overflow
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Apr 23 19:44:08 2021 +0200| [a09127eacd33596b8e18974e639082f170828d2e] | committer: Michael Niedermayer avformat/dsicin: Check packet size for overflow Fixes: signed integer overflow: 24672 + 2147483424 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_DSICIN_fuzzer-6731325979623424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 9d1c47ec033d038e04578eaf0767c8983250d03d) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a09127eacd33596b8e18974e639082f170828d2e --- libavformat/dsicin.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index b18f43b9a0..5a1f256595 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -166,7 +166,8 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) CinDemuxContext *cin = s->priv_data; AVIOContext *pb = s->pb; CinFrameHeader *hdr = >frame_header; -int rc, palette_type, pkt_size; +int rc, palette_type; +int64_t pkt_size; int ret; if (cin->audio_buffer_size == 0) { @@ -182,7 +183,9 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) } /* palette and video packet */ -pkt_size = (palette_type + 3) * hdr->pal_colors_count + hdr->video_frame_size; +pkt_size = (palette_type + 3LL) * hdr->pal_colors_count + hdr->video_frame_size; +if (pkt_size + 4 > INT_MAX) +return AVERROR_INVALIDDATA; pkt_size = ffio_limit(pb, pkt_size); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/bfi: check nframes
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Apr 23 19:33:58 2021 +0200| [6d86416c92c127de23f5d62fa5d40cf3613c4b14] | committer: Michael Niedermayer avformat/bfi: check nframes Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_BFI_fuzzer-6737028768202752 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit b4e77dfca1c2970446f79277034d8e60c3fe3f4e) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d86416c92c127de23f5d62fa5d40cf3613c4b14 --- libavformat/bfi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 2dab986f3a..f9e0bb2e30 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -73,6 +73,8 @@ static int bfi_read_header(AVFormatContext * s) return AVERROR_INVALIDDATA; bfi->nframes = avio_rl32(pb); +if (bfi->nframes < 0) +return AVERROR_INVALIDDATA; avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/avidec: fix position overflow in avi_load_index()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Apr 23 19:11:03 2021 +0200| [f89b52fbca6fb162a3dfb5d7c36164fd10242448] | committer: Michael Niedermayer avformat/avidec: fix position overflow in avi_load_index() Fixes: signed integer overflow: 9223372033098784808 + 4294967072 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6732488912273408 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 527821a2dd6f19d9a4d2abe05833346ae86c66c6) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f89b52fbca6fb162a3dfb5d7c36164fd10242448 --- libavformat/avidec.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 59929afd49..079f2dbf8a 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1783,7 +1783,10 @@ static int avi_load_index(AVFormatContext *s) size = avio_rl32(pb); if (avio_feof(pb)) break; -next = avio_tell(pb) + size + (size & 1); +next = avio_tell(pb); +if (next < 0 || next > INT64_MAX - size - (size & 1)) +break; +next += size + (size & 1LL); if (tag == MKTAG('i', 'd', 'x', '1') && avi_read_idx1(s, size) >= 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/dsfdec: Change order of operations in bitrate computation
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Apr 23 19:39:16 2021 +0200| [70fa5522c76d0564f1fad7a9e2bbd83587529af0] | committer: Michael Niedermayer avformat/dsfdec: Change order of operations in bitrate computation Fixes: signed integer overflow: 538976288 * 67372036 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_DSF_fuzzer-6751696819716096 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 5e38eff284637e9f7c3c25d020df549ca6667e40) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=70fa5522c76d0564f1fad7a9e2bbd83587529af0 --- libavformat/dsfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c index 1df163e114..71dbf2f112 100644 --- a/libavformat/dsfdec.c +++ b/libavformat/dsfdec.c @@ -129,7 +129,7 @@ static int dsf_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } st->codecpar->block_align *= st->codecpar->channels; -st->codecpar->bit_rate = st->codecpar->channels * st->codecpar->sample_rate * 8LL; +st->codecpar->bit_rate = st->codecpar->channels * 8LL * st->codecpar->sample_rate; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); avio_skip(pb, 4); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/asfdec_f: Check sizeX against padding
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Apr 23 17:35:20 2021 +0200| [622b48d1fb8d4be750f291b58de078e2c47dff80] | committer: Michael Niedermayer avformat/asfdec_f: Check sizeX against padding Fixes: signed integer overflow: 2147483607 + 64 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6753897878257664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit f034c2e36acb7d0c11dc1849ddf8a67bde44eff4) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=622b48d1fb8d4be750f291b58de078e2c47dff80 --- libavformat/asfdec_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index f784e62996..c0265af20d 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -522,7 +522,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) tag1 = avio_rl32(pb); avio_skip(pb, 20); if (sizeX > 40) { -if (size < sizeX - 40) +if (size < sizeX - 40 || sizeX - 40 > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return AVERROR_INVALIDDATA; st->codecpar->extradata_size = ffio_limit(pb, sizeX - 40); st->codecpar->extradata = av_mallocz(st->codecpar->extradata_size + ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/aiffdec: Check for size overflow in header parsing
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Apr 23 17:28:29 2021 +0200| [31324803665d52b8635cbc99a91d0419cf1f] | committer: Michael Niedermayer avformat/aiffdec: Check for size overflow in header parsing Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6723467048255488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit bae2e1977744f42d56b85193d4910811de829714) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31324803665d52b8635cbc99a91d0419cf1f --- libavformat/aiffdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index dcaf1560b6..8b85fea809 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -100,6 +100,9 @@ static int get_aiff_header(AVFormatContext *s, int size, int sample_rate; unsigned int num_frames; +if (size == INT_MAX) +return AVERROR_INVALIDDATA; + if (size & 1) size++; par->codec_type = AVMEDIA_TYPE_AUDIO; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/aaccoder: Add minimal bias in search_for_ms()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Mon May 31 21:00:32 2021 +0200| [3a67e33368c45cf767a7aedf60e025135589e144] | committer: Michael Niedermayer avcodec/aaccoder: Add minimal bias in search_for_ms() Fixes: floating point division by 0 Fixes: Ticket8218 Signed-off-by: Michael Niedermayer (cherry picked from commit 75a099fc734a4ee2b1347d0a3d8c53d883b95174) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3a67e33368c45cf767a7aedf60e025135589e144 --- libavcodec/aaccoder.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index baa82489b1..11b0559e1c 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -843,25 +843,25 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) sce0->ics.swb_sizes[g], sce0->sf_idx[w*16+g], sce0->band_type[w*16+g], -lambda / band0->threshold, INFINITY, , NULL, 0); +lambda / (band0->threshold + FLT_MIN), INFINITY, , NULL, 0); dist1 += quantize_band_cost(s, >coeffs[start + (w+w2)*128], R34, sce1->ics.swb_sizes[g], sce1->sf_idx[w*16+g], sce1->band_type[w*16+g], -lambda / band1->threshold, INFINITY, , NULL, 0); +lambda / (band1->threshold + FLT_MIN), INFINITY, , NULL, 0); dist2 += quantize_band_cost(s, M, M34, sce0->ics.swb_sizes[g], mididx, midcb, -lambda / minthr, INFINITY, , NULL, 0); +lambda / (minthr + FLT_MIN), INFINITY, , NULL, 0); dist2 += quantize_band_cost(s, S, S34, sce1->ics.swb_sizes[g], sididx, sidcb, -mslambda / (minthr * bmax), INFINITY, , NULL, 0); +mslambda / (minthr * bmax + FLT_MIN), INFINITY, , NULL, 0); B0 += b1+b2; B1 += b3+b4; dist1 -= b1+b2; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov: Fix incorrect overflow detection in mov_read_sidx()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Wed Apr 28 16:53:52 2021 +0200| [da9e84fabd0285204df60a032e0846fe70be0068] | committer: Michael Niedermayer avformat/mov: Fix incorrect overflow detection in mov_read_sidx() Fixes: signed integer overflow: 9223372036854775807 + 1442840321 cannot be represented in type 'long' Fixes: 33670/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644379491106816 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 200406d930eff3202f3230f188f85f4ab9cf4525) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da9e84fabd0285204df60a032e0846fe70be0068 --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 56c538cf63..b49dd01543 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5132,7 +5132,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (frag_stream_info) frag_stream_info->sidx_pts = timestamp; -if (av_sat_add64(offset, size) != offset + size || +if (av_sat_add64(offset, size) != offset + (uint64_t)size || av_sat_add64(pts, duration) != pts + (uint64_t)duration ) return AVERROR_INVALIDDATA; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov: Avoid undefined overflow in time_offset calculation
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue Apr 20 17:40:56 2021 +0200| [890a801468c1ec615ea4dfc667053f9ac571ea95] | committer: Michael Niedermayer avformat/mov: Avoid undefined overflow in time_offset calculation Fixes: signed integer overflow: 8511838621821575200 - -3954125146725285889 cannot be represented in type 'long' Fixes: 33414/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6610119325515776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 7666d588ba1af26ce479e7fb92f7dc5b3a2ca48e) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=890a801468c1ec615ea4dfc667053f9ac571ea95 --- libavformat/mov.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 0f5a961c2e..56c538cf63 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3837,7 +3837,11 @@ static void mov_build_index(MOVContext *mov, AVStream *st) if ((empty_duration || start_time) && mov->time_scale > 0) { if (empty_duration) empty_duration = av_rescale(empty_duration, sc->time_scale, mov->time_scale); -sc->time_offset = start_time - empty_duration; + +if (av_sat_sub64(start_time, empty_duration) != start_time - (uint64_t)empty_duration) +av_log(mov->fc, AV_LOG_WARNING, "start_time - empty_duration is not representable\n"); + +sc->time_offset = start_time - (uint64_t)empty_duration; sc->min_corrected_pts = start_time; if (!mov->advanced_editlist) current_dts = -sc->time_offset; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/af_drmeter: Check that there is data
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Jun 5 20:28:24 2021 +0200| [ebc5ea216f3ab12551eecb2ceee15bb868298208] | committer: Michael Niedermayer avfilter/af_drmeter: Check that there is data Fixes: floating point division by 0 Fixes: -nan is outside the range of representable values of type 'int' Fixes: Ticket8307 Signed-off-by: Michael Niedermayer (cherry picked from commit 4f49fa6abe89e2fca2585cac4c63190315972cf0) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ebc5ea216f3ab12551eecb2ceee15bb868298208 --- libavfilter/af_drmeter.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavfilter/af_drmeter.c b/libavfilter/af_drmeter.c index ecccb65186..425c25ae87 100644 --- a/libavfilter/af_drmeter.c +++ b/libavfilter/af_drmeter.c @@ -167,6 +167,11 @@ static void print_stats(AVFilterContext *ctx) float chdr, secondpeak, rmssum = 0; int i, j, first = 0; +if (!p->nb_samples) { +av_log(ctx, AV_LOG_INFO, "No data, dynamic range not meassurable\n"); +return; +} + finish_block(p); for (i = 0; i <= 1; i++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_fftdnoiz: Use lrintf() in export_row8()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Jun 5 20:12:08 2021 +0200| [c7ac580288138d274a2418789fef78f0298f] | committer: Michael Niedermayer avfilter/vf_fftdnoiz: Use lrintf() in export_row8() Fixes: 1.04064e+10 is outside the range of representable values of type 'int' Fixes: Ticket 8279 Signed-off-by: Michael Niedermayer (cherry picked from commit 1f21349d20d9bda8eeeddb23263892be0cea12e3) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7ac580288138d274a2418789fef78f0298f --- libavfilter/vf_fftdnoiz.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_fftdnoiz.c b/libavfilter/vf_fftdnoiz.c index 856d716be5..eea1887e40 100644 --- a/libavfilter/vf_fftdnoiz.c +++ b/libavfilter/vf_fftdnoiz.c @@ -161,7 +161,7 @@ static void export_row8(FFTComplex *src, uint8_t *dst, int rw, float scale, int int j; for (j = 0; j < rw; j++) -dst[j] = av_clip_uint8(src[j].re * scale + 0.5f); +dst[j] = av_clip_uint8(lrintf(src[j].re * scale)); } static void import_row16(FFTComplex *dst, uint8_t *srcp, int rw) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_mestimate: Check b_count
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Jun 5 20:04:45 2021 +0200| [433d93a3b61b2a40c2f0b89fcd24303bc068d05f] | committer: Michael Niedermayer avfilter/vf_mestimate: Check b_count Fixes: left shift of negative value -1 Fixes: Ticket8270 Signed-off-by: Michael Niedermayer (cherry picked from commit 06af6e101bbd04e8ecc5337bc3b6894a5e058e14) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=433d93a3b61b2a40c2f0b89fcd24303bc068d05f --- libavfilter/vf_mestimate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/vf_mestimate.c b/libavfilter/vf_mestimate.c index 7ecfe7da60..9a2865a0cb 100644 --- a/libavfilter/vf_mestimate.c +++ b/libavfilter/vf_mestimate.c @@ -100,6 +100,9 @@ static int config_input(AVFilterLink *inlink) s->b_height = inlink->h >> s->log2_mb_size; s->b_count = s->b_width * s->b_height; +if (s->b_count == 0) +return AVERROR(EINVAL); + for (i = 0; i < 3; i++) { s->mv_table[i] = av_mallocz_array(s->b_count, sizeof(*s->mv_table[0])); if (!s->mv_table[i]) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mov: do not ignore errors in mov_metadata_hmmt()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Jul 11 14:27:22 2021 +0200| [5334967a56891ad4bd1c490dd4b1a17493b9e81e] | committer: Michael Niedermayer avformat/mov: do not ignore errors in mov_metadata_hmmt() Fixes: Timeout Fixes: 35637/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6311060272447488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit c52c99a18f6e40973e52d99d4bb29e34a66c695a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5334967a56891ad4bd1c490dd4b1a17493b9e81e --- libavformat/mov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index d6427b3574..0f5a961c2e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -294,6 +294,8 @@ static int mov_metadata_hmmt(MOVContext *c, AVIOContext *pb, unsigned len) int moment_time = avio_rb32(pb); avpriv_new_chapter(c->fc, i, av_make_q(1, 1000), moment_time, AV_NOPTS_VALUE, NULL); } +if (avio_feof(pb)) +return AVERROR_INVALIDDATA; return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mxfdec: Check size for shrinking
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Jul 11 12:39:34 2021 +0200| [aa5b8c95907e75f9289e5b4dda28deabd30d294e] | committer: Michael Niedermayer avformat/mxfdec: Check size for shrinking av_shrink_packet() takes int size, so size must fit in int Fixes: out of array access Fixes: 35607/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4875541323841536 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 65b862ab59c4bfaae98be596b84a072f52444398) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa5b8c95907e75f9289e5b4dda28deabd30d294e --- libavformat/mxfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 840484b37e..c51eed32ec 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -624,7 +624,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv return AVERROR_INVALIDDATA; // enc. code size = klv_decode_ber_length(pb); -if (size < 32 || size - 32 < orig_size) +if (size < 32 || size - 32 < orig_size || (int)orig_size != orig_size) return AVERROR_INVALIDDATA; avio_read(pb, ivec, 16); avio_read(pb, tmpbuf, 16); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/dnxhddec: check and propagate function return value
ffmpeg | branch: release/4.4 | maryam ebr | Tue Aug 3 01:05:47 2021 -0400| [46bbf194c44e49f08bbb028c5b933a901a84a7bd] | committer: Michael Niedermayer avcodec/dnxhddec: check and propagate function return value Similar to CVE-2013-0868, here return value check for 'init_vlc' is needed. crafted DNxHD data can cause unspecified impact. Reviewed-by: Paul B Mahol Signed-off-by: James Almer (cherry picked from commit 7150f9575671f898382c370acae35f9087a30ba1) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46bbf194c44e49f08bbb028c5b933a901a84a7bd --- libavcodec/dnxhddec.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index c78d55aee5..9b475a6979 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -112,6 +112,7 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx) static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth) { +int ret; if (cid != ctx->cid) { const CIDEntry *cid_table = ff_dnxhd_get_cid_table(cid); @@ -132,19 +133,26 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth) ff_free_vlc(>dc_vlc); ff_free_vlc(>run_vlc); -init_vlc(>ac_vlc, DNXHD_VLC_BITS, 257, +if ((ret = init_vlc(>ac_vlc, DNXHD_VLC_BITS, 257, ctx->cid_table->ac_bits, 1, 1, - ctx->cid_table->ac_codes, 2, 2, 0); -init_vlc(>dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12, + ctx->cid_table->ac_codes, 2, 2, 0)) < 0) +goto out; +if ((ret = init_vlc(>dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12, ctx->cid_table->dc_bits, 1, 1, - ctx->cid_table->dc_codes, 1, 1, 0); -init_vlc(>run_vlc, DNXHD_VLC_BITS, 62, + ctx->cid_table->dc_codes, 1, 1, 0)) < 0) +goto out; +if ((ret = init_vlc(>run_vlc, DNXHD_VLC_BITS, 62, ctx->cid_table->run_bits, 1, 1, - ctx->cid_table->run_codes, 2, 2, 0); + ctx->cid_table->run_codes, 2, 2, 0)) < 0) +goto out; ctx->cid = cid; } -return 0; +ret = 0; +out: +if (ret < 0) +av_log(ctx->avctx, AV_LOG_ERROR, "init_vlc failed\n"); +return ret; } static int dnxhd_get_profile(int cid) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale/slice: Fix wrong return on error
ffmpeg | branch: release/4.4 | Michael Niedermayer | Fri Jul 9 15:20:47 2021 +0200| [b21120a92494b88f7b5d65c2f3d24aa25846cb96] | committer: Michael Niedermayer swscale/slice: Fix wrong return on error Signed-off-by: Michael Niedermayer (cherry picked from commit 7874d40f10cca922797a8da14189a53ee52f0156) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b21120a92494b88f7b5d65c2f3d24aa25846cb96 --- libswscale/slice.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libswscale/slice.c b/libswscale/slice.c index 68517da00b..b185b4aa18 100644 --- a/libswscale/slice.c +++ b/libswscale/slice.c @@ -288,8 +288,10 @@ int ff_init_filters(SwsContext * c) if (!c->desc) return AVERROR(ENOMEM); c->slice = av_mallocz_array(sizeof(SwsSlice), c->numSlice); -if (!c->slice) +if (!c->slice) { +res = AVERROR(ENOMEM); goto cleanup; +} res = alloc_slice(>slice[0], c->srcFormat, c->srcH, c->chrSrcH, c->chrSrcHSubSample, c->chrSrcVSubSample, 0); if (res < 0) goto cleanup; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/aacdec_template: Avoid some invalid values to be set by decode_audio_specific_config_gb()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Mon Jul 5 22:09:26 2021 +0200| [6a5d7fd8ad1cf420fc290998632973198e4f741b] | committer: Michael Niedermayer avcodec/aacdec_template: Avoid some invalid values to be set by decode_audio_specific_config_gb() Fixes: NULL pointer dereference Fixes: decode_spectrum_and_dequant.mp4 Found-by: Rafael Dutra Signed-off-by: Michael Niedermayer (cherry picked from commit eaec4df63f98b6d2d60d2cf441de250c5f69359e) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a5d7fd8ad1cf420fc290998632973198e4f741b --- libavcodec/aacdec_template.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 98f77a3ad7..3d7f3257db 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1076,14 +1076,18 @@ static int decode_audio_specific_config_gb(AACContext *ac, { int i, ret; GetBitContext gbc = *gb; +MPEG4AudioConfig m4ac_bak = *m4ac; -if ((i = ff_mpeg4audio_get_config_gb(m4ac, , sync_extension, avctx)) < 0) +if ((i = ff_mpeg4audio_get_config_gb(m4ac, , sync_extension, avctx)) < 0) { +*m4ac = m4ac_bak; return AVERROR_INVALIDDATA; +} if (m4ac->sampling_index > 12) { av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index); +*m4ac = m4ac_bak; return AVERROR_INVALIDDATA; } if (m4ac->object_type == AOT_ER_AAC_LD && @@ -1091,6 +1095,7 @@ static int decode_audio_specific_config_gb(AACContext *ac, av_log(avctx, AV_LOG_ERROR, "invalid low delay sampling rate index %d\n", m4ac->sampling_index); +*m4ac = m4ac_bak; return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/lpc: check for zero err in normalization in compute_lpc_coefs()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Mon May 31 15:27:18 2021 +0200| [1196932f1cee6b6a3776b62e6bf1d5dac82236c7] | committer: Michael Niedermayer avcodec/lpc: check for zero err in normalization in compute_lpc_coefs() Fixes: floating point division by 0 Fixes: Ticket8213 Signed-off-by: Michael Niedermayer (cherry picked from commit 70874e024a6eae0f95bd8dd4b9b4367ffd937f41) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1196932f1cee6b6a3776b62e6bf1d5dac82236c7 --- libavcodec/lpc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h index 52170fd623..e1b41bfd9b 100644 --- a/libavcodec/lpc.h +++ b/libavcodec/lpc.h @@ -186,7 +186,8 @@ static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_o for(j=0; jhttps://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale/slice: Check slice for allocation failure
ffmpeg | branch: release/4.4 | Michael Niedermayer | Wed Jul 7 14:05:26 2021 +0200| [8da08ef1ffe7b2297a07d631038ddf4021c51ae1] | committer: Michael Niedermayer swscale/slice: Check slice for allocation failure Fixes: null pointer dereference Fixes: alloc_slice.mp4 Found-by: Rafael Dutra Signed-off-by: Michael Niedermayer (cherry picked from commit 997f9cfc1295769be8d3180860ceebbc16f59069) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8da08ef1ffe7b2297a07d631038ddf4021c51ae1 --- libswscale/slice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libswscale/slice.c b/libswscale/slice.c index d96db13364..68517da00b 100644 --- a/libswscale/slice.c +++ b/libswscale/slice.c @@ -288,7 +288,8 @@ int ff_init_filters(SwsContext * c) if (!c->desc) return AVERROR(ENOMEM); c->slice = av_mallocz_array(sizeof(SwsSlice), c->numSlice); - +if (!c->slice) +goto cleanup; res = alloc_slice(>slice[0], c->srcFormat, c->srcH, c->chrSrcH, c->chrSrcHSubSample, c->chrSrcVSubSample, 0); if (res < 0) goto cleanup; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/j2kenc: Check for av_strtok() failure
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue May 18 22:44:19 2021 +0200| [09f47af7473524fedb1cf0fa17d627c90dac991d] | committer: Michael Niedermayer avcodec/j2kenc: Check for av_strtok() failure Fixes: CID1466601 Dereference null return value Signed-off-by: Michael Niedermayer (cherry picked from commit 6a6a765fa4ca57143453093af3bf8d1c8a52d0b0) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09f47af7473524fedb1cf0fa17d627c90dac991d --- libavcodec/j2kenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index e3c5a32188..212b9601c4 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -1679,7 +1679,7 @@ static int parse_layer_rates(Jpeg2000EncoderContext *s) } token = av_strtok(s->lr_str, ",", ); -if (rate = strtol(token, NULL, 10)) { +if (token && (rate = strtol(token, NULL, 10))) { s->layer_rates[0] = rate <= 1 ? 0:rate; nlayers++; } else { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/matroskadec: Fix handling of huge default durations
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue May 11 18:40:32 2021 +0200| [3b6f7601b7ebadfab725b0853c3661c9432652f1] | committer: Michael Niedermayer avformat/matroskadec: Fix handling of huge default durations Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself Fixes: 33997/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6752039691485184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 343d950a4a8a8c32f5f7d9d4ac1fbe317cb9cc80) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b6f7601b7ebadfab725b0853c3661c9432652f1 --- libavformat/matroskadec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 65756ae06d..a2efdb42b0 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2807,8 +2807,9 @@ static int matroska_parse_tracks(AVFormatContext *s) st->need_parsing = AVSTREAM_PARSE_HEADERS; if (track->default_duration) { +int div = track->default_duration <= INT64_MAX ? 1 : 2; av_reduce(>avg_frame_rate.num, >avg_frame_rate.den, - 10, track->default_duration, 3); + 10 / div, track->default_duration / div, 3); #if FF_API_R_FRAME_RATE if ( st->avg_frame_rate.num < st->avg_frame_rate.den * 1000LL && st->avg_frame_rate.num > st->avg_frame_rate.den * 5LL) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/ftp: Check for av_strtok() failure
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue May 18 22:38:40 2021 +0200| [35a2e713857723eeca3ba148d144c62b1c1b2d5f] | committer: Michael Niedermayer avformat/ftp: Check for av_strtok() failure Fixes: CID1396258 Dereference null return value Signed-off-by: Michael Niedermayer (cherry picked from commit 9d40782088cf969fbadc881e4a97ec22b8ae0177) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35a2e713857723eeca3ba148d144c62b1c1b2d5f --- libavformat/ftp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/ftp.c b/libavformat/ftp.c index caeea42920..69caa7670c 100644 --- a/libavformat/ftp.c +++ b/libavformat/ftp.c @@ -972,6 +972,8 @@ static int ftp_parse_entry_mlsd(char *mlsd, AVIODirEntry *next) continue; } fact = av_strtok(fact, "=", ); +if (!fact) +continue; if (!av_strcasecmp(fact, "type")) { if (!av_strcasecmp(value, "cdir") || !av_strcasecmp(value, "pdir")) return 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] tools/cws2fws: Check read() for failure
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun May 16 20:36:46 2021 +0200| [9f97a023d63f1d6027a4ebb6d5cd71f127370e1e] | committer: Michael Niedermayer tools/cws2fws: Check read() for failure Fixes: CID1452579 Argument cannot be negative Signed-off-by: Michael Niedermayer (cherry picked from commit 0b3cdd7cc2c63969e144cc3eb39d0c61260509ee) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f97a023d63f1d6027a4ebb6d5cd71f127370e1e --- tools/cws2fws.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tools/cws2fws.c b/tools/cws2fws.c index 7046b69957..9ce321fe20 100644 --- a/tools/cws2fws.c +++ b/tools/cws2fws.c @@ -89,6 +89,12 @@ int main(int argc, char *argv[]) for (i = 0; i < comp_len - 8;) { int ret, len = read(fd_in, _in, 1024); +if (len == -1) { +printf("read failure\n"); +inflateEnd(); +goto out; +} + dbgprintf("read %d bytes\n", len); last_out = zstream.total_out; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/cpia: Fix missing src_size update
ffmpeg | branch: release/4.4 | Michael Niedermayer | Mon Jun 21 22:59:04 2021 +0200| [8f0d442434436787c1e96152f46f4a41bf08a11b] | committer: Michael Niedermayer avcodec/cpia: Fix missing src_size update Fixes: out of array read Fixes: 35210/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CPIA_fuzzer-5669199688105984 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit cea05864e65db9a2dc8af82b2c63fb8f03c5f876) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8f0d442434436787c1e96152f46f4a41bf08a11b --- libavcodec/cpia.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c index 5f12a99a83..435834d617 100644 --- a/libavcodec/cpia.c +++ b/libavcodec/cpia.c @@ -111,6 +111,7 @@ static int cpia_decode_frame(AVCodecContext *avctx, // Read line length, two byte little endian linelength = AV_RL16(src); src += 2; +src_size -= 2; if (src_size < linelength) { frame->decode_error_flags = FF_DECODE_ERROR_INVALID_BITSTREAM; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/exr: Better size checks
ffmpeg | branch: release/4.4 | Michael Niedermayer | Mon Jun 21 22:15:47 2021 +0200| [7b5308045e16954e2bf9b5b51516d98a53872101] | committer: Michael Niedermayer avcodec/exr: Better size checks Fixes: signed integer overflow: 3530839700044513368 + 8386093932303352321 cannot be represented in type 'long long' Fixes: 35182/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5398383270428672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 18b0dd07384b2987f24a4d0ba7600fde2787472a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b5308045e16954e2bf9b5b51516d98a53872101 --- libavcodec/exr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 83e8a58e27..27c243c12c 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1014,7 +1014,7 @@ static int dwa_uncompress(EXRContext *s, const uint8_t *src, int compressed_size dc_count = AV_RL64(src + 72); ac_compression = AV_RL64(src + 80); -if (compressed_size < 88LL + lo_size + ac_size + dc_size + rle_csize) +if (compressed_size < (uint64_t)(lo_size | ac_size | dc_size | rle_csize) || compressed_size < 88LL + lo_size + ac_size + dc_size + rle_csize) return AVERROR_INVALIDDATA; bytestream2_init(, src + 88, compressed_size - 88); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/clearvideo: Check tile_size to be not too large
ffmpeg | branch: release/4.4 | Michael Niedermayer | Mon Jun 21 21:02:39 2021 +0200| [bb1d2cf8984da6a99394093f454f21a273fbce9b] | committer: Michael Niedermayer avcodec/clearvideo: Check tile_size to be not too large Fixes: left shift of 1 by 31 places cannot be represented in type 'int' Fixes: 35023/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-6740166587842560 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 11fac9613e6a340d4d9968e2d8a43c3726ab57d3) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb1d2cf8984da6a99394093f454f21a273fbce9b --- libavcodec/clearvideo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index b3ccb51334..a56e09069b 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -722,8 +722,8 @@ static av_cold int clv_decode_init(AVCodecContext *avctx) } c->tile_shift = av_log2(c->tile_size); -if (1U << c->tile_shift != c->tile_size || c->tile_shift < 1) { -av_log(avctx, AV_LOG_ERROR, "Tile size: %d, is not power of 2 > 1\n", c->tile_size); +if (1U << c->tile_shift != c->tile_size || c->tile_shift < 1 || c->tile_shift > 30) { +av_log(avctx, AV_LOG_ERROR, "Tile size: %d, is not power of 2 > 1 and < 2^31\n", c->tile_size); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/utils: Use 64bit for intermediate in AV_CODEC_ID_ADPCM_THP* duration calculation
ffmpeg | branch: release/4.4 | Michael Niedermayer | Thu Jun 24 20:00:05 2021 +0200| [417bc2a5b087b569a43652948643a11780a0442c] | committer: Michael Niedermayer avcodec/utils: Use 64bit for intermediate in AV_CODEC_ID_ADPCM_THP* duration calculation Fixes: signed integer overflow: 486539264 * 14 cannot be represented in type 'int' Fixes: 35281/clusterfuzz-testcase-minimized-ffmpeg_dem_RSD_fuzzer-6068262742917120 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 00ae9b77ef757f82660b4b3d2f490374a4f209fd) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=417bc2a5b087b569a43652948643a11780a0442c --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 3f69c9c114..af121ff910 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -749,7 +749,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, case AV_CODEC_ID_ADPCM_THP: case AV_CODEC_ID_ADPCM_THP_LE: if (extradata) -return frame_bytes * 14 / (8 * ch); +return frame_bytes * 14LL / (8 * ch); break; case AV_CODEC_ID_ADPCM_XA: return (frame_bytes / 128) * 224 / ch; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/aaxdec: Check avio_seek() in header reading
ffmpeg | branch: release/4.4 | Michael Niedermayer | Mon Apr 12 21:21:08 2021 +0200| [5f891809d774a41d2d492a120b7f1ebb6f7e6276] | committer: Michael Niedermayer avformat/aaxdec: Check avio_seek() in header reading Fixes: Timeout Fixes: 32450/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-4875522262827008 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 602bbf71f683dc564822c39070c42246d2c2b5e2) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f891809d774a41d2d492a120b7f1ebb6f7e6276 --- libavformat/aaxdec.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c index c6d2d1c8d1..e69e5615ee 100644 --- a/libavformat/aaxdec.c +++ b/libavformat/aaxdec.c @@ -117,6 +117,7 @@ static int aax_read_header(AVFormatContext *s) int64_t column_offset = 0; int ret, extradata_size; char *codec; +int64_t ret64; avio_skip(pb, 4); a->table_size = avio_rb32(pb) + 8LL; @@ -218,7 +219,10 @@ static int aax_read_header(AVFormatContext *s) } } -avio_seek(pb, a->strings_offset, SEEK_SET); +ret = ret64 = avio_seek(pb, a->strings_offset, SEEK_SET); +if (ret64 < 0) +goto fail; + ret = avio_read(pb, a->string_table, a->strings_size); if (ret != a->strings_size) { if (ret < 0) @@ -249,7 +253,10 @@ static int aax_read_header(AVFormatContext *s) goto fail; } -avio_seek(pb, data_offset, SEEK_SET); +ret = ret64 = avio_seek(pb, data_offset, SEEK_SET); +if (ret64 < 0) +goto fail; + if (type == COLUMN_TYPE_VLDATA) { int64_t start, size; @@ -281,8 +288,8 @@ static int aax_read_header(AVFormatContext *s) codec = a->string_table + a->name_offset; if (!strcmp(codec, "AAX")) { par->codec_id = AV_CODEC_ID_ADPCM_ADX; -avio_seek(pb, a->segments[0].start, SEEK_SET); -if (avio_rb16(pb) != 0x8000) { +ret64 = avio_seek(pb, a->segments[0].start, SEEK_SET); +if (ret64 < 0 || avio_rb16(pb) != 0x8000) { ret = AVERROR_INVALIDDATA; goto fail; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/hevc_sei: Use get_bits_long() for time_offset_value
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Jun 19 15:11:41 2021 +0200| [b49039b23ed55ea444be817b4082f130e8f9b8b3] | committer: Michael Niedermayer avcodec/hevc_sei: Use get_bits_long() for time_offset_value Fixes: assertion failure Fixes: crash_1 Found-by: Thuan Pham Signed-off-by: Michael Niedermayer (cherry picked from commit d866787dacc04079daa73a1a836e849c56cded66) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b49039b23ed55ea444be817b4082f130e8f9b8b3 --- libavcodec/hevc_sei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index c881c4338c..e6ae777852 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -386,7 +386,7 @@ static int decode_nal_sei_timecode(HEVCSEITimeCode *s, GetBitContext *gb) s->time_offset_length[i] = get_bits(gb, 5); if (s->time_offset_length[i] > 0) { -s->time_offset_value[i] = get_bits(gb, s->time_offset_length[i]); +s->time_offset_value[i] = get_bits_long(gb, s->time_offset_length[i]); } } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/rmdec: Check old_format len for overflow
ffmpeg | branch: release/4.4 | Michael Niedermayer | Mon Apr 26 22:35:37 2021 +0200| [ee34b6549f76f5ad0719b48debffd7e1c292701e] | committer: Michael Niedermayer avformat/rmdec: Check old_format len for overflow Maybe such large values could be disallowed earlier and closer to where they are set. Fixes: signed integer overflow: 538976288 * 8224 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-6704350354341888 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 06d174e289eb185f03a34a738965f0042f39c038) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee34b6549f76f5ad0719b48debffd7e1c292701e --- libavformat/rmdec.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index fc3bff4859..36765b4763 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -1012,8 +1012,8 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) { RMDemuxContext *rm = s->priv_data; AVStream *st = NULL; // init to silence compiler warning -int i, len, res, seq = 1; -int64_t timestamp, pos; +int i, res, seq = 1; +int64_t timestamp, pos, len; int flags; for (;;) { @@ -1032,7 +1032,9 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) ast = st->priv_data; timestamp = AV_NOPTS_VALUE; len = !ast->audio_framesize ? RAW_PACKET_SIZE : -ast->coded_framesize * ast->sub_packet_h / 2; +ast->coded_framesize * (int64_t)ast->sub_packet_h / 2; +if (len > INT_MAX) +return AVERROR_INVALIDDATA; flags = (seq++ == 1) ? 2 : 0; pos = avio_tell(s->pb); } else { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/realtextdec: Check the pts difference before using it for the duration computation
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Apr 25 20:45:10 2021 +0200| [de255793d2800822a2cfc13e30a865824daed51f] | committer: Michael Niedermayer avformat/realtextdec: Check the pts difference before using it for the duration computation Fixes: signed integer overflow: 540420 - -9223372031709351616 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_REALTEXT_fuzzer-6737340551790592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit fe12aa689003db9b07a6e1b837031dcc57a71435) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de255793d2800822a2cfc13e30a865824daed51f --- libavformat/realtextdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c index f534774420..368a741240 100644 --- a/libavformat/realtextdec.c +++ b/libavformat/realtextdec.c @@ -111,10 +111,11 @@ static int realtext_read_header(AVFormatContext *s) if (!merge) { const char *begin = ff_smil_get_attr_ptr(buf.str, "begin"); const char *end = ff_smil_get_attr_ptr(buf.str, "end"); +int64_t endi = end ? read_ts(end) : 0; sub->pos = pos; sub->pts = begin ? read_ts(begin) : 0; -sub->duration = end ? (read_ts(end) - sub->pts) : duration; +sub->duration = (end && endi > sub->pts && endi - (uint64_t)sub->pts <= INT64_MAX) ? endi - sub->pts : duration; } } av_bprint_clear(); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/qcp: Avoid negative nb_rates
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Apr 25 20:16:38 2021 +0200| [9957286378035b5578889aa8bd8381b0d641d564] | committer: Michael Niedermayer avformat/qcp: Avoid negative nb_rates Fixes: signed integer overflow: 2 * -1725947872 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_QCP_fuzzer-6726807632084992 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 1b865cc703d29cb307e1fa628aa02940d54eb42a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9957286378035b5578889aa8bd8381b0d641d564 --- libavformat/qcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/qcp.c b/libavformat/qcp.c index 168030dc16..4478875f2d 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -93,7 +93,8 @@ static int qcp_read_header(AVFormatContext *s) QCPContext*c = s->priv_data; AVStream *st = avformat_new_stream(s, NULL); uint8_t buf[16]; -int i, nb_rates; +int i; +unsigned nb_rates; if (!st) return AVERROR(ENOMEM); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/pp_bnk: Use 64bit in bitrate computation
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Apr 25 20:12:13 2021 +0200| [b425df191cc3c4a764f69b6455b5dbf4a9277cf7] | committer: Michael Niedermayer avformat/pp_bnk: Use 64bit in bitrate computation Fixes: signed integer overflow: 1207959552 * 4 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_PP_BNK_fuzzer-6747301169201152 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 88fc295838b3cf16b43c0bbea5766fe92b18dd17) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b425df191cc3c4a764f69b6455b5dbf4a9277cf7 --- libavformat/pp_bnk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c index 07eeca3cd5..5ffe733b18 100644 --- a/libavformat/pp_bnk.c +++ b/libavformat/pp_bnk.c @@ -223,7 +223,7 @@ static int pp_bnk_read_header(AVFormatContext *s) par->bits_per_coded_sample = 4; par->bits_per_raw_sample= 16; par->block_align= 1; -par->bit_rate = par->sample_rate * par->bits_per_coded_sample * par->channels; +par->bit_rate = par->sample_rate * (int64_t)par->bits_per_coded_sample * par->channels; avpriv_set_pts_info(st, 64, 1, par->sample_rate); st->start_time = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/subtitles: Check pts difference before use
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Apr 25 19:49:14 2021 +0200| [8bddb1d3ef8b8c9263da64b5e606dca5cd96] | committer: Michael Niedermayer avformat/subtitles: Check pts difference before use Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_MPL2_fuzzer-6747053545881600 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit e7a990164f67108e99ec5adb8b2d636cd4147715) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8bddb1d3ef8b8c9263da64b5e606dca5cd96 --- libavformat/subtitles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 05c07cd852..6368ec74f9 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -206,7 +206,7 @@ void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q) q->sort == SUB_SORT_TS_POS ? cmp_pkt_sub_ts_pos : cmp_pkt_sub_pos_ts); for (i = 0; i < q->nb_subs; i++) -if (q->subs[i]->duration < 0 && i < q->nb_subs - 1) +if (q->subs[i]->duration < 0 && i < q->nb_subs - 1 && q->subs[i + 1]->pts - (uint64_t)q->subs[i]->pts <= INT64_MAX) q->subs[i]->duration = q->subs[i + 1]->pts - q->subs[i]->pts; if (!q->keep_duplicates) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/nutdec: Check tmp_size
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Apr 25 20:01:03 2021 +0200| [acfce11c48a1d19d16b9cef798e9350e44581cd5] | committer: Michael Niedermayer avformat/nutdec: Check tmp_size Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6739990530883584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 1ca00b5e44f21840b608e238fa135a1aab6e576b) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=acfce11c48a1d19d16b9cef798e9350e44581cd5 --- libavformat/nutdec.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index fbecf71328..58a74612a4 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -286,6 +286,11 @@ static int decode_main_header(NUTContext *nut) ret = AVERROR_INVALIDDATA; goto fail; } +if (tmp_size < 0 || tmp_size > INT_MAX - count) { +av_log(s, AV_LOG_ERROR, "illegal size\n"); +ret = AVERROR_INVALIDDATA; +goto fail; +} for (j = 0; j < count; j++, i++) { if (i == 'N') { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mpc8: Check for position overflow in mpc8_handle_chunk()
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Apr 24 17:42:19 2021 +0200| [a04d889c52fcab97d41d6df5745a8d4d9f489e91] | committer: Michael Niedermayer avformat/mpc8: Check for position overflow in mpc8_handle_chunk() Fixes: signed integer overflow: 15 + 9223372036854775796 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6723520756318208 Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6739833034768384 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 8ef25d118246bf443900033fb3588dba628d11b0) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a04d889c52fcab97d41d6df5745a8d4d9f489e91 --- libavformat/mpc8.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 88c55e3d22..95813df748 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -205,8 +205,11 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in switch(tag){ case TAG_SEEKTBLOFF: -pos = avio_tell(pb) + size; +pos = avio_tell(pb); off = ffio_read_varlen(pb); +if (pos > INT64_MAX - size || off < 0 || off > INT64_MAX - chunk_pos) +return; +pos += size; mpc8_parse_seektable(s, chunk_pos + off); avio_seek(pb, pos, SEEK_SET); break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/msf: Check that channels doesnt overflow during extradata construction
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Apr 25 19:54:19 2021 +0200| [704e4b8213c9064afb07f83ba85453b40114cb6c] | committer: Michael Niedermayer avformat/msf: Check that channels doesnt overflow during extradata construction Fixes: signed integer overflow: 2048 * 1122336 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_MSF_fuzzer-6726959600107520 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit a1a277926b49dad60d9e78c6c7a8c6b5d0d6d7c9) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=704e4b8213c9064afb07f83ba85453b40114cb6c --- libavformat/msf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/msf.c b/libavformat/msf.c index 155f488e44..1eaed54357 100644 --- a/libavformat/msf.c +++ b/libavformat/msf.c @@ -70,6 +70,8 @@ static int msf_read_header(AVFormatContext *s) case 4: case 5: case 6: st->codecpar->block_align = (codec == 4 ? 96 : codec == 5 ? 152 : 192) * st->codecpar->channels; +if (st->codecpar->channels > UINT16_MAX / 2048) +return AVERROR_INVALIDDATA; ret = ff_alloc_extradata(st->codecpar, 14); if (ret < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/iff: Use 64bit in duration computation
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Apr 24 15:41:16 2021 +0200| [ce60ee3e5c650dfaee4a2343c208960413eb75d1] | committer: Michael Niedermayer avformat/iff: Use 64bit in duration computation Fixes: signed integer overflow: 588 * 16719904 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-6748331936186368 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 93d964689c3b2bae26e6e3f502c1ffc4c2e46989) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce60ee3e5c650dfaee4a2343c208960413eb75d1 --- libavformat/iff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/iff.c b/libavformat/iff.c index b07b6c8b18..c15302d3c5 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -385,7 +385,7 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt) avio_skip(pb, 1); pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = 0; -pkt->duration = 588 * s->streams[0]->codecpar->sample_rate / 44100; +pkt->duration = 588LL * s->streams[0]->codecpar->sample_rate / 44100; pkt->pos = chunk_pos; chunk_pos = avio_tell(pb); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mccdec: Fix overflows in num/den
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Apr 24 16:37:34 2021 +0200| [612472c64796d67a2a689e6d34d82dbe9cc494d6] | committer: Michael Niedermayer avformat/mccdec: Fix overflows in num/den Fixes: signed integer overflow: 6365816 * 1000 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_MCC_fuzzer-6737934184218624 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit ff05326081922059314b8927cf9bbc9c7e73458f) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=612472c64796d67a2a689e6d34d82dbe9cc494d6 --- libavformat/mccdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/mccdec.c b/libavformat/mccdec.c index 2a0b7905a0..627471a1fe 100644 --- a/libavformat/mccdec.c +++ b/libavformat/mccdec.c @@ -127,8 +127,7 @@ static int mcc_read_header(AVFormatContext *s) num = strtol(rate_str, , 10); den = 1; if (df && !av_strncasecmp(df, "DF", 2)) { -num *= 1000; -den = 1001; +av_reduce(, , num * 1000LL, 1001, INT_MAX); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/dxa: Check fps to be within the supported range more precissely
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sat Apr 24 13:08:24 2021 +0200| [982654b90c8d33e3c15567b09fff719545470188] | committer: Michael Niedermayer avformat/dxa: Check fps to be within the supported range more precissely Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself Fixes: assertion failure Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_DXA_fuzzer-6744985740378112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 6ea494befcb5d944ce8275e6f59de1a24c25ffb6) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=982654b90c8d33e3c15567b09fff719545470188 --- libavformat/dxa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 909c5ba2ba..cd9c489851 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -79,7 +79,7 @@ static int dxa_read_header(AVFormatContext *s) if(fps > 0){ den = 1000; num = fps; -}else if (fps < 0){ +}else if (fps < 0 && fps > INT_MIN){ den = 10; num = -fps; }else{ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/tta: Check for EOF in index reading loop
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue May 4 18:34:44 2021 +0200| [b354bcf0277277f7de2816e1894c934f5e7f215e] | committer: Michael Niedermayer avformat/tta: Check for EOF in index reading loop Fixes: OOM Fixes: 33585/clusterfuzz-testcase-minimized-ffmpeg_dem_TTA_fuzzer-4564665830080512 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit b72d657b73b2aa4a2a2f72f613199e6080ad48c0) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b354bcf0277277f7de2816e1894c934f5e7f215e --- libavformat/tta.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/tta.c b/libavformat/tta.c index 07faa82eb3..6aa72b5d1d 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -119,6 +119,8 @@ static int tta_read_header(AVFormatContext *s) for (i = 0; i < c->totalframes; i++) { uint32_t size = avio_rl32(s->pb); int r; +if (avio_feof(s->pb)) +return AVERROR_INVALIDDATA; if ((r = av_add_index_entry(st, framepos, i * (int64_t)c->frame_size, size, 0, AVINDEX_KEYFRAME)) < 0) return r; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/iff: Only write palette to plane 1 if its PAL8
ffmpeg | branch: release/4.4 | Michael Niedermayer | Tue May 4 22:52:41 2021 +0200| [b01534293e40487816ec08d4b2128df61f5b859a] | committer: Michael Niedermayer avcodec/iff: Only write palette to plane 1 if its PAL8 Fixes: null pointer passed as argument 1, which is declared to never be null Fixes: 33791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5107575256383488.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 216eb60b853e9a230c1238ab7d1c63d3fa892d34) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b01534293e40487816ec08d4b2128df61f5b859a --- libavcodec/iff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 79f6215c77..76d3696bb3 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -1848,7 +1848,8 @@ static int decode_frame(AVCodecContext *avctx, buf += s->planesize; } } -memcpy(frame->data[1], s->pal, 256 * 4); +if (avctx->pix_fmt == AV_PIX_FMT_PAL8) +memcpy(frame->data[1], s->pal, 256 * 4); } else if (s->ham) { int i, count = 1 << s->ham; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/h264_parser: Fix nalsize check
ffmpeg | branch: master | Michael Niedermayer | Sun Sep 5 21:24:17 2021 +0200| [2d36d2fbd775fa9e2a92b1225b1964c5a8499df3] | committer: Michael Niedermayer avcodec/h264_parser: Fix nalsize check Fixes: Assertion failure Fixes: 37463/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-4914693494931456 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2d36d2fbd775fa9e2a92b1225b1964c5a8499df3 --- libavcodec/h264_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 01ea016409..cff801f613 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -83,12 +83,12 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, for (i = 0; i < buf_size; i++) { if (i >= next_avc) { -uint32_t nalsize = 0; +int64_t nalsize = 0; i = next_avc; for (j = 0; j < p->nal_length_size; j++) nalsize = (nalsize << 8) | buf[i++]; if (!nalsize || nalsize > buf_size - i) { -av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %"PRIu32" " +av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %"PRId64" " "remaining %d\n", nalsize, buf_size - i); return buf_size; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/af_silenceremove: fix stop_silence handling
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 15:37:36 2021 +0200| [38ab20e591ce9d6e0b30717fca29011127b66ef7] | committer: Paul B Mahol avfilter/af_silenceremove: fix stop_silence handling > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38ab20e591ce9d6e0b30717fca29011127b66ef7 --- libavfilter/af_silenceremove.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 166961442e..6f3250bbb1 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -792,17 +792,20 @@ silence_copy: } else if (!threshold) { for (j = 0; j < outlink->channels; j++) { s->update(s, in, j, nb_samples_read); -if (s->stop_silence) { +if (s->stop_silence) s->copy(s, s->stop_silence_hold, in, j, s->stop_silence_offset, nb_samples_read); -s->stop_silence_end = FFMIN(s->stop_silence_end + 1, s->stop_silence); -if (s->stop_silence_offset >= s->stop_silence) { -s->stop_silence_offset = 0; -} -} s->copy(s, s->stop_holdoff, in, j, s->stop_holdoff_end, nb_samples_read); } +if (s->stop_silence) { +s->stop_silence_offset++; +s->stop_silence_end = FFMIN(s->stop_silence_end + 1, s->stop_silence); +if (s->stop_silence_offset >= s->stop_silence) { +s->stop_silence_offset = 0; +} +} + s->window_offset++; if (s->window_offset >= s->window_duration) s->window_offset = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/af_silenceremove: fix processing of periods > 1
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 13:06:43 2021 +0200| [3b331468dae2e88ee6c87c257ac159ad662efcac] | committer: Paul B Mahol avfilter/af_silenceremove: fix processing of periods > 1 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b331468dae2e88ee6c87c257ac159ad662efcac --- libavfilter/af_silenceremove.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 056be91bae..804193f3a8 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -93,6 +93,8 @@ typedef struct SilenceRemoveContext { int64_t window_duration; double sum; +int threshold; +int one_period; int restart; int64_t next_pts; @@ -107,14 +109,14 @@ typedef struct SilenceRemoveContext { #define AF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM static const AVOption silenceremove_options[] = { -{ "start_periods", NULL, OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF }, +{ "start_periods", "set periods of silence parts to skip from start", OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF }, { "start_duration", "set start duration of non-silence part", OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, { "start_threshold", "set threshold for start silence detection", OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, { "start_silence", "set start duration of silence part to keep", OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, { "start_mode", "set which channel will trigger trimming from start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" }, { "any", 0, 0, AV_OPT_TYPE_CONST,{.i64=T_ANY}, 0, 0, AF, "mode" }, { "all", 0, 0, AV_OPT_TYPE_CONST,{.i64=T_ALL}, 0, 0, AF, "mode" }, -{ "stop_periods",NULL, OFFSET(stop_periods),AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF }, +{ "stop_periods","set periods of silence parts to skip from end", OFFSET(stop_periods),AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF }, { "stop_duration", "set stop duration of non-silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, { "stop_silence","set stop duration of silence part to keep", OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, @@ -430,6 +432,7 @@ static int config_input(AVFilterLink *inlink) AVFilterContext *ctx = inlink->dst; SilenceRemoveContext *s = ctx->priv; +s->threshold = -1; s->next_pts = AV_NOPTS_VALUE; s->window_duration = av_rescale(s->window_duration_opt, inlink->sample_rate, AV_TIME_BASE); @@ -603,8 +606,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; SilenceRemoveContext *s = ctx->priv; -int i, j, threshold, ret = 0; int nbs, nb_samples_read, nb_samples_written; +int i, j, threshold, ret = 0; AVFrame *out; nb_samples_read = nb_samples_written = 0; @@ -632,6 +635,10 @@ silence_trim: } } +if (s->threshold >= 0) +s->one_period = s->threshold != threshold; +s->threshold = threshold; + if (threshold) { for (j = 0; j < outlink->channels; j++) { s->update(s, in, j, nb_samples_read); @@ -645,7 +652,8 @@ silence_trim: nb_samples_read++; if (s->start_holdoff_end >= s->start_duration) { -if (++s->start_found_periods >= s->start_periods) { +s->start_found_periods += s->one_period; +if (s->start_found_periods >= s->start_periods) { s->mode = SILENCE_TRIM_FLUSH; goto silence_trim_flush; } @@ -757,6 +765,10 @@ silence_copy: } } +if (s->threshold >= 0) +s->one_period = s->threshold != threshold; +s->threshold = threshold; + if (threshold
[FFmpeg-cvslog] avfilter/af_silenceremove: avoid returning 1 sample duration frames
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 15:15:19 2021 +0200| [8a42ee6697317d0a30438df5905dfc0247cd28e7] | committer: Paul B Mahol avfilter/af_silenceremove: avoid returning 1 sample duration frames > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a42ee6697317d0a30438df5905dfc0247cd28e7 --- libavfilter/af_silenceremove.c | 56 -- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 804193f3a8..166961442e 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -23,6 +23,7 @@ #include /* DBL_MAX */ +#include "libavutil/audio_fifo.h" #include "libavutil/avassert.h" #include "libavutil/opt.h" #include "libavutil/timestamp.h" @@ -103,6 +104,8 @@ typedef struct SilenceRemoveContext { double (*compute)(struct SilenceRemoveContext *s, AVFrame *frame, int ch, int offset); void (*copy)(struct SilenceRemoveContext *s, AVFrame *out, AVFrame *in, int ch, int out_offset, int in_offset); + +AVAudioFifo *fifo; } SilenceRemoveContext; #define OFFSET(x) offsetof(SilenceRemoveContext, x) @@ -542,12 +545,16 @@ static int config_input(AVFilterLink *inlink) return AVERROR_BUG; } +s->fifo = av_audio_fifo_alloc(inlink->format, inlink->channels, 1024); +if (!s->fifo) +return AVERROR(ENOMEM); + return 0; } static void flush(SilenceRemoveContext *s, AVFrame *out, AVFilterLink *outlink, - int *nb_samples_written, int *ret, int flush_silence) + int *nb_samples_written, int flush_silence) { AVFrame *silence; @@ -559,22 +566,18 @@ static void flush(SilenceRemoveContext *s, (AVRational){1, outlink->sample_rate}, outlink->time_base); -*ret = ff_filter_frame(outlink, out); -if (*ret < 0) -return; +av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples); *nb_samples_written = 0; -} else { -av_frame_free(); } +av_frame_free(); + if (s->stop_silence_end <= 0 || !flush_silence) return; silence = ff_get_audio_buffer(outlink, s->stop_silence_end); -if (!silence) { -*ret = AVERROR(ENOMEM); +if (!silence) return; -} if (s->stop_silence_offset < s->stop_silence_end) { av_samples_copy(silence->extended_data, s->stop_silence_hold->extended_data, 0, @@ -598,7 +601,8 @@ static void flush(SilenceRemoveContext *s, (AVRational){1, outlink->sample_rate}, outlink->time_base); -*ret = ff_filter_frame(outlink, silence); +av_audio_fifo_write(s->fifo, (void **)silence->extended_data, silence->nb_samples); +av_frame_free(); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -727,7 +731,8 @@ silence_trim_flush: s->start_holdoff_offset += nbs; -ret = ff_filter_frame(outlink, out); +av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples); +av_frame_free(); if (s->start_holdoff_offset == s->start_holdoff_end) { s->start_holdoff_offset = 0; @@ -771,7 +776,7 @@ silence_copy: if (threshold && s->stop_holdoff_end && !s->stop_silence) { s->mode = SILENCE_COPY_FLUSH; -flush(s, out, outlink, _samples_written, , 0); +flush(s, out, outlink, _samples_written, 0); goto silence_copy_flush; } else if (threshold) { for (j = 0; j < outlink->channels; j++) { @@ -812,7 +817,7 @@ silence_copy: if (!s->restart) { s->mode = SILENCE_STOP; -flush(s, out, outlink, _samples_written, , 1); +flush(s, out, outlink, _samples_written, 1); goto silence_stop; } else { s->stop_found_periods = 0; @@ -823,17 +828,17 @@ silence_copy: s->start_silence_end = 0; clear_window(s); s->mode = SILENCE_TRIM; -flush(s, out, outlink, _samples_written, , 1); +flush(s, out, outlink, _samples_written, 1); goto silence_trim; } } s->mode = SILENCE_COPY_FLUSH; -flush(s, out, outlink, _samples_written, , 0); +flush(s, out, outlink, _samples_written, 0); goto silence_copy_flush;
[FFmpeg-cvslog] avfilter/af_silenceremove: guard against negative numbers
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 10:05:53 2021 +0200| [5e7e2e5031cd032bfddc0fe2cf0587e4175d] | committer: Paul B Mahol avfilter/af_silenceremove: guard against negative numbers > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e7e2e5031cd032bfddc0fe2cf0587e4175d --- libavfilter/af_silenceremove.c | 16 1 file changed, 16 insertions(+) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index f2f563c5cd..056be91bae 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -178,6 +178,7 @@ static double compute_peak_double(SilenceRemoveContext *s, AVFrame *frame, int c new_sum = s->sum; new_sum -= wsample; +new_sum = fmax(new_sum, 0.); new_sum += fabs(sample); return new_sum / s->window_duration; @@ -191,6 +192,7 @@ static void update_peak_double(SilenceRemoveContext *s, AVFrame *frame, int ch, double *wsample = [frame->channels * s->window_offset + ch]; s->sum -= *wsample; +s->sum = fmax(s->sum, 0.); *wsample = fabs(sample); s->sum += *wsample; } @@ -205,6 +207,7 @@ static double compute_peak_float(SilenceRemoveContext *s, AVFrame *frame, int ch new_sum = s->sum; new_sum -= wsample; +new_sum = fmaxf(new_sum, 0.f); new_sum += fabsf(sample); return new_sum / s->window_duration; @@ -218,6 +221,7 @@ static void update_peak_float(SilenceRemoveContext *s, AVFrame *frame, int ch, i float *wsample = [frame->channels * s->window_offset + ch]; s->sum -= *wsample; +s->sum = fmaxf(s->sum, 0.f); *wsample = fabsf(sample); s->sum += *wsample; } @@ -232,6 +236,7 @@ static double compute_rms_double(SilenceRemoveContext *s, AVFrame *frame, int ch new_sum = s->sum; new_sum -= wsample; +new_sum = fmax(new_sum, 0.); new_sum += sample * sample; av_assert2(new_sum >= 0.); @@ -246,6 +251,7 @@ static void update_rms_double(SilenceRemoveContext *s, AVFrame *frame, int ch, i double *wsample = [frame->channels * s->window_offset + ch]; s->sum -= *wsample; +s->sum = fmax(s->sum, 0.); *wsample = sample * sample; s->sum += *wsample; } @@ -260,6 +266,7 @@ static double compute_rms_float(SilenceRemoveContext *s, AVFrame *frame, int ch, new_sum = s->sum; new_sum -= wsample; +new_sum = fmaxf(new_sum, 0.f); new_sum += sample * sample; av_assert2(new_sum >= 0.f); @@ -274,6 +281,7 @@ static void update_rms_float(SilenceRemoveContext *s, AVFrame *frame, int ch, in float *wsample = [frame->channels * s->window_offset + ch]; s->sum -= *wsample; +s->sum = fmaxf(s->sum, 0.f); *wsample = sample * sample; s->sum += *wsample; } @@ -288,6 +296,7 @@ static double compute_peak_doublep(SilenceRemoveContext *s, AVFrame *frame, int new_sum = s->sum; new_sum -= wsample; +new_sum = fmax(new_sum, 0.); new_sum += fabs(sample); return new_sum / s->window_duration; @@ -301,6 +310,7 @@ static void update_peak_doublep(SilenceRemoveContext *s, AVFrame *frame, int ch, double *wsample = [s->window_offset]; s->sum -= *wsample; +s->sum = fmax(s->sum, 0.); *wsample = fabs(sample); s->sum += *wsample; } @@ -315,6 +325,7 @@ static double compute_peak_floatp(SilenceRemoveContext *s, AVFrame *frame, int c new_sum = s->sum; new_sum -= wsample; +new_sum = fmaxf(new_sum, 0.f); new_sum += fabsf(sample); return new_sum / s->window_duration; @@ -328,6 +339,7 @@ static void update_peak_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch, float *wsample = [s->window_offset]; s->sum -= *wsample; +s->sum = fmaxf(s->sum, 0.f); *wsample = fabsf(sample); s->sum += *wsample; } @@ -342,6 +354,7 @@ static double compute_rms_doublep(SilenceRemoveContext *s, AVFrame *frame, int c new_sum = s->sum; new_sum -= wsample; +new_sum = fmax(new_sum, 0.); new_sum += sample * sample; av_assert2(new_sum >= 0.); @@ -356,6 +369,7 @@ static void update_rms_doublep(SilenceRemoveContext *s, AVFrame *frame, int ch, double *wsample = [s->window_offset]; s->sum -= *wsample; +s->sum = fmax(s->sum, 0.); *wsample = sample * sample; s->sum += *wsample; } @@ -370,6 +384,7 @@ static double compute_rms_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch new_sum = s->sum; new_sum -= wsample; +new_sum = fmaxf(new_sum, 0.f); new_sum += sample * sample; av_assert2(new_sum >= 0.f); @@ -384,6 +399,7 @@ static void update_rms_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch, i float *wsample = [s->window_offset]; s->sum -= *wsample; +s->sum = fmaxf(s->sum, 0.f); *wsample = sample * sample; s->sum += *wsample; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org
[FFmpeg-cvslog] avfilter/af_silenceremove: add asserts to check for NaNs
ffmpeg | branch: master | Paul B Mahol | Wed Sep 8 09:42:27 2021 +0200| [c3e11e3092201e7cb98fb5e342705fa5d0c811df] | committer: Paul B Mahol avfilter/af_silenceremove: add asserts to check for NaNs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3e11e3092201e7cb98fb5e342705fa5d0c811df --- libavfilter/af_silenceremove.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 77a0b2e2fb..f2f563c5cd 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -23,6 +23,7 @@ #include /* DBL_MAX */ +#include "libavutil/avassert.h" #include "libavutil/opt.h" #include "libavutil/timestamp.h" #include "audio.h" @@ -233,6 +234,7 @@ static double compute_rms_double(SilenceRemoveContext *s, AVFrame *frame, int ch new_sum -= wsample; new_sum += sample * sample; +av_assert2(new_sum >= 0.); return sqrt(new_sum / s->window_duration); } @@ -260,6 +262,7 @@ static double compute_rms_float(SilenceRemoveContext *s, AVFrame *frame, int ch, new_sum -= wsample; new_sum += sample * sample; +av_assert2(new_sum >= 0.f); return sqrtf(new_sum / s->window_duration); } @@ -341,6 +344,7 @@ static double compute_rms_doublep(SilenceRemoveContext *s, AVFrame *frame, int c new_sum -= wsample; new_sum += sample * sample; +av_assert2(new_sum >= 0.); return sqrt(new_sum / s->window_duration); } @@ -368,6 +372,7 @@ static double compute_rms_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch new_sum -= wsample; new_sum += sample * sample; +av_assert2(new_sum >= 0.f); return sqrtf(new_sum / s->window_duration); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".