[FFmpeg-cvslog] avcodec/internal: Move FF_DEFAULT_QUANT_BIAS to mpegvideoenc.h
ffmpeg | branch: master | Andreas Rheinhardt | Thu Mar 17 12:23:13 2022 +0100| [fa989df1c68527bde027623b3902edf96b9845c5] | committer: Andreas Rheinhardt avcodec/internal: Move FF_DEFAULT_QUANT_BIAS to mpegvideoenc.h Only used there. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa989df1c68527bde027623b3902edf96b9845c5 --- libavcodec/internal.h | 2 -- libavcodec/mpegvideoenc.h | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 351c057d01..badca4c9dd 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -35,8 +35,6 @@ #include "bsf.h" #include "config.h" -#define FF_DEFAULT_QUANT_BIAS 99 - #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 #define FF_QSCALE_TYPE_H264 2 diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h index 9619f6787a..fae41457bf 100644 --- a/libavcodec/mpegvideoenc.h +++ b/libavcodec/mpegvideoenc.h @@ -29,7 +29,6 @@ #define AVCODEC_MPEGVIDEOENC_H #include "libavutil/opt.h" -#include "internal.h" #include "mpegvideo.h" #define UNI_AC_ENC_INDEX(run,level) ((run)*128 + (level)) @@ -42,6 +41,8 @@ #define FF_MPV_FLAG_NAQ 0x0010 #define FF_MPV_FLAG_MV0 0x0020 +#define FF_DEFAULT_QUANT_BIAS 99 + #define FF_MPV_OPT_CMP_FUNC \ { "sad","Sum of absolute differences, fast", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SAD }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "cmp_func" }, \ { "sse","Sum of squared errors", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SSE }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "cmp_func" }, \ ___ 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/internal: Move FF_SIGNBIT and ff_log2_run to mathops.h
ffmpeg | branch: master | Andreas Rheinhardt | Thu Mar 17 12:16:38 2022 +0100| [86c909558ce3e7505d5a63647c27cd0a4314a603] | committer: Andreas Rheinhardt avcodec/internal: Move FF_SIGNBIT and ff_log2_run to mathops.h It is a more fitting place for them. Also move the definition of ff_log2_run to mathtables.c. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86c909558ce3e7505d5a63647c27cd0a4314a603 --- libavcodec/aptx.c | 2 +- libavcodec/bitstream.c | 9 - libavcodec/cavs.c | 4 libavcodec/cavsdec.c| 1 + libavcodec/dnxhdenc.c | 2 +- libavcodec/ffv1dec.c| 1 - libavcodec/ffv1enc.c| 1 - libavcodec/internal.h | 4 libavcodec/jpeglsdec.c | 2 -- libavcodec/jpeglsenc.c | 1 - libavcodec/mathops.h| 3 +++ libavcodec/mathtables.c | 9 + 12 files changed, 15 insertions(+), 24 deletions(-) diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c index b1a78c5f77..f2604be60c 100644 --- a/libavcodec/aptx.c +++ b/libavcodec/aptx.c @@ -21,7 +21,7 @@ */ #include "aptx.h" -#include "internal.h" +#include "mathops.h" static const int32_t quantize_intervals_LF[65] = { diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index 36a980646d..3606575055 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -36,15 +36,6 @@ #include "libavutil/intreadwrite.h" #include "put_bits.h" -const uint8_t ff_log2_run[41]={ - 0, 0, 0, 0, 1, 1, 1, 1, - 2, 2, 2, 2, 3, 3, 3, 3, - 4, 4, 5, 5, 6, 6, 7, 7, - 8, 9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23, -24, -}; - void ff_put_string(PutBitContext *pb, const char *string, int terminate_string) { while (*string) { diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index 5367c44248..87bbe26f98 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -25,14 +25,10 @@ * @author Stefan Gehrer */ -#include "libavutil/mem_internal.h" - #include "avcodec.h" -#include "get_bits.h" #include "golomb.h" #include "h264chroma.h" #include "idctdsp.h" -#include "internal.h" #include "mathops.h" #include "qpeldsp.h" #include "cavs.h" diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index ba7ead6f41..760dd792cb 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -32,6 +32,7 @@ #include "cavs.h" #include "codec_internal.h" #include "internal.h" +#include "mathops.h" #include "mpeg12data.h" #include "startcode.h" diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 6d4d7e01c7..1795993efe 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -33,7 +33,7 @@ #include "codec_internal.h" #include "encode.h" #include "fdctdsp.h" -#include "internal.h" +#include "mathops.h" #include "mpegvideo.h" #include "mpegvideoenc.h" #include "pixblockdsp.h" diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index a5aae79c94..d1f69ae6e1 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -32,7 +32,6 @@ #include "libavutil/pixdesc.h" #include "avcodec.h" #include "codec_internal.h" -#include "internal.h" #include "get_bits.h" #include "rangecoder.h" #include "golomb.h" diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index edaa8b4b3d..13af2547a0 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -35,7 +35,6 @@ #include "avcodec.h" #include "encode.h" #include "codec_internal.h" -#include "internal.h" #include "put_bits.h" #include "put_golomb.h" #include "rangecoder.h" diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 854c969395..351c057d01 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -44,8 +44,6 @@ #define FF_SANE_NB_CHANNELS 512U -#define FF_SIGNBIT(x) ((x) >> CHAR_BIT * sizeof(x) - 1) - #if HAVE_SIMD_ALIGN_64 # define STRIDE_ALIGN 64 /* AVX-512 */ #elif HAVE_SIMD_ALIGN_32 @@ -159,8 +157,6 @@ typedef struct AVCodecInternal { AVChannelLayout initial_ch_layout; } AVCodecInternal; -extern const uint8_t ff_log2_run[41]; - /** * Return the index into tab at which {a,b} match elements {[0],[1]} of tab. * If there is no such matching pair then size is returned. diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index c3d0a1c9a7..4c747b3919 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -29,9 +29,7 @@ #include "codec_internal.h" #include "get_bits.h" #include "golomb.h" -#include "internal.h" #include "mathops.h" -#include "mjpeg.h" #include "mjpegdec.h" #include "jpegls.h" #include "jpeglsdec.h" diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c index 42c2d6b038..dbd7941df2 100644 --- a/libavcodec/jpeglsenc.c +++ b/libavcodec/jpeglsenc.c @@ -34,7 +34,6 @@ #include "get_bits.h" #include "put_bits.h" #include "put_golomb.h" -#include "internal.h" #include "mathops.h" #include "mjpeg.h" #include "jpegls.h" diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h index 239e0e492f..f81d21f9c4 100644 --- a/libavcodec/mathops.h +++ b/libavcodec/mathops.h @@
[FFmpeg-cvslog] avcodec/bitstream: Move code for initializing VLCs to file of its own
ffmpeg | branch: master | Andreas Rheinhardt | Thu Mar 17 11:33:02 2022 +0100| [495de744fa949eb789441349736bedc2301d0b61] | committer: Andreas Rheinhardt avcodec/bitstream: Move code for initializing VLCs to file of its own bitstream.c is currently the disjoint union of three parts: The first part is ff_log2_run, the second part are some auxiliary functions for the PutBits-API; and the third part is the code for creating VLCs. This commit moves the latter into a file of its own. This has the advantage of making one of the hacks in tableprint_vlc.h redundant as vlc.c does not include config.h (whereas the PutBits-API part does). Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=495de744fa949eb789441349736bedc2301d0b61 --- libavcodec/Makefile | 1 + libavcodec/bitstream.c | 349 libavcodec/tableprint_vlc.h | 4 +- libavcodec/vlc.c| 378 4 files changed, 380 insertions(+), 352 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index dc6dc8a4bb..fb8b0e824b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -55,6 +55,7 @@ OBJS = ac3_parser.o \ qsv_api.o\ raw.o\ utils.o \ + vlc.o\ vorbis_parser.o \ xiph.o \ diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index 04817f9a84..36a980646d 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -28,23 +28,13 @@ * bitstream api. */ -#include #include -#include #include #include "config.h" #include "libavutil/avassert.h" -#include "libavutil/error.h" -#include "libavutil/internal.h" #include "libavutil/intreadwrite.h" -#include "libavutil/log.h" -#include "libavutil/macros.h" -#include "libavutil/mem.h" -#include "libavutil/qsort.h" -#include "libavutil/reverse.h" #include "put_bits.h" -#include "vlc.h" const uint8_t ff_log2_run[41]={ 0, 0, 0, 0, 1, 1, 1, 1, @@ -89,342 +79,3 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length) put_bits(pb, bits, AV_RB16(src + 2 * words) >> (16 - bits)); } - -/* VLC decoding */ - -#define GET_DATA(v, table, i, wrap, size) \ -{ \ -const uint8_t *ptr = (const uint8_t *)table + i * wrap; \ -switch(size) { \ -case 1: \ -v = *(const uint8_t *)ptr; \ -break; \ -case 2: \ -v = *(const uint16_t *)ptr; \ -break; \ -case 4: \ -default:\ -av_assert1(size == 4); \ -v = *(const uint32_t *)ptr; \ -break; \ -} \ -} - - -static int alloc_table(VLC *vlc, int size, int use_static) -{ -int index = vlc->table_size; - -vlc->table_size += size; -if (vlc->table_size > vlc->table_allocated) { -if (use_static) -abort(); // cannot do anything, init_vlc() is used with too little memory -vlc->table_allocated += (1 << vlc->bits); -vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(VLC_TYPE) * 2); -if (!vlc->table) { -vlc->table_allocated = 0; -vlc->table_size = 0; -return AVERROR(ENOMEM); -} -memset(vlc->table + vlc->table_allocated - (1 << vlc->bits), 0, sizeof(VLC_TYPE) * 2 << vlc->bits); -} -return index; -} - -#define LOCALBUF_ELEMS 1500 // the maximum currently needed is 1296 by rv34 - -static av_always_inline uint32_t bitswap_32(uint32_t x) -{ -return (uint32_t)ff_reverse[ x& 0xFF] << 24 | - (uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 | - (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 | - (uint32_t)ff_reverse[ x >> 24]; -} - -typedef struct VLCcode { -uint8_t bits; -VLC_TYPE symbol; -/** codeword, with the first bit-to-be-read in the msb - * (even if intended for a little-endian bitstream reader) */ -uint32_t code; -} VLCcode; - -static int vlc_common_init(VLC *vlc, int nb_bits, int nb_codes, -
[FFmpeg-cvslog] avcodec/mathops: Move bitswap_32() to its only user
ffmpeg | branch: master | Andreas Rheinhardt | Thu Mar 17 10:39:42 2022 +0100| [b303f1e08335bb6ab4c4e58ec3771ae2cac2b33f] | committer: Andreas Rheinhardt avcodec/mathops: Move bitswap_32() to its only user Effectively reverts eaff1aa09e90e2711207c9463db8bf8e8dec8178 given that bitswap_32 is no longer used outside of bitstream.c since 03008c2811ec26cf338780a89b6b2b849b399e3c. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b303f1e08335bb6ab4c4e58ec3771ae2cac2b33f --- libavcodec/bitstream.c | 11 +-- libavcodec/dstdec.c| 1 + libavcodec/mathops.h | 9 - libavcodec/mpeg12dec.c | 1 + libavcodec/pcm.c | 1 + libavcodec/s302m.c | 1 + libavcodec/s302menc.c | 1 + libavcodec/tiff.c | 1 + libavcodec/xbmdec.c| 1 + libavcodec/xbmenc.c| 1 + 10 files changed, 17 insertions(+), 11 deletions(-) diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index c948c889b6..04817f9a84 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -35,7 +35,6 @@ #include "config.h" #include "libavutil/avassert.h" -#include "libavutil/bswap.h" #include "libavutil/error.h" #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" @@ -43,7 +42,7 @@ #include "libavutil/macros.h" #include "libavutil/mem.h" #include "libavutil/qsort.h" -#include "mathops.h" +#include "libavutil/reverse.h" #include "put_bits.h" #include "vlc.h" @@ -134,6 +133,14 @@ static int alloc_table(VLC *vlc, int size, int use_static) #define LOCALBUF_ELEMS 1500 // the maximum currently needed is 1296 by rv34 +static av_always_inline uint32_t bitswap_32(uint32_t x) +{ +return (uint32_t)ff_reverse[ x& 0xFF] << 24 | + (uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 | + (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 | + (uint32_t)ff_reverse[ x >> 24]; +} + typedef struct VLCcode { uint8_t bits; VLC_TYPE symbol; diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c index 0458856580..3ea3f38eee 100644 --- a/libavcodec/dstdec.c +++ b/libavcodec/dstdec.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/mem_internal.h" +#include "libavutil/reverse.h" #include "codec_internal.h" #include "internal.h" #include "get_bits.h" diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h index 1c35664318..239e0e492f 100644 --- a/libavcodec/mathops.h +++ b/libavcodec/mathops.h @@ -25,7 +25,6 @@ #include #include "libavutil/common.h" -#include "libavutil/reverse.h" #include "config.h" #define MAX_NEG_CROP 1024 @@ -240,12 +239,4 @@ static inline int8_t ff_u8_to_s8(uint8_t a) return b.s8; } -static av_always_inline uint32_t bitswap_32(uint32_t x) -{ -return (uint32_t)ff_reverse[ x& 0xFF] << 24 | - (uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 | - (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 | - (uint32_t)ff_reverse[ x >> 24]; -} - #endif /* AVCODEC_MATHOPS_H */ diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 6110e63af8..6b6cadeb05 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -34,6 +34,7 @@ #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/mem_internal.h" +#include "libavutil/reverse.h" #include "libavutil/stereo3d.h" #include "libavutil/timecode.h" diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 1e83b356ac..aaccd86199 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -28,6 +28,7 @@ #include "config_components.h" #include "libavutil/attributes.h" #include "libavutil/float_dsp.h" +#include "libavutil/reverse.h" #include "libavutil/thread.h" #include "avcodec.h" #include "bytestream.h" diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c index 2c0cfc699a..d90549e487 100644 --- a/libavcodec/s302m.c +++ b/libavcodec/s302m.c @@ -24,6 +24,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" #include "libavutil/log.h" +#include "libavutil/reverse.h" #include "avcodec.h" #include "codec_internal.h" #include "internal.h" diff --git a/libavcodec/s302menc.c b/libavcodec/s302menc.c index ad5186d69c..737fc94697 100644 --- a/libavcodec/s302menc.c +++ b/libavcodec/s302menc.c @@ -21,6 +21,7 @@ */ #include "libavutil/channel_layout.h" +#include "libavutil/reverse.h" #include "avcodec.h" #include "codec_internal.h" #include "encode.h" diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 88ac838587..fdd3ae5c68 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -39,6 +39,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/imgutils.h" #include "libavutil/opt.h" +#include "libavutil/reverse.h" #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c index 0ea5883024..9dbd0ac571 100644 --- a/libavcodec/xbmdec.c +++ b/libavcodec/xbmdec.c @@ -21,6 +21,7 @@ */ #include "libavutil/avstring.h"
[FFmpeg-cvslog] avformat/mxfdec: Do not clear array in mxf_read_strong_ref_array() before writing
ffmpeg | branch: master | Michael Niedermayer | Sun Mar 13 00:37:35 2022 +0100| [7aebdb8bf1fc3e09263617a7f49101cba2d43804] | committer: Michael Niedermayer avformat/mxfdec: Do not clear array in mxf_read_strong_ref_array() before writing Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7aebdb8bf1fc3e09263617a7f49101cba2d43804 --- libavformat/mxfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 49ed02185f..30dd40749c 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -942,7 +942,7 @@ static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count) *count = c; av_free(*refs); -*refs = av_calloc(*count, sizeof(UID)); +*refs = av_malloc_array(*count, sizeof(UID)); if (!*refs) { *count = 0; 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/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array()
ffmpeg | branch: master | Michael Niedermayer | Sun Mar 13 00:36:55 2022 +0100| [8d6f49cfc339825f3f3f8a910e4bb4c0f822db1f] | committer: Michael Niedermayer avformat/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array() Fixes: 42827/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4900528511909888 Reviewed-by: Tomas Härdin Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d6f49cfc339825f3f3f8a910e4bb4c0f822db1f --- libavformat/mxfdec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index a858bbb7be..49ed02185f 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -933,6 +933,7 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count) { +int64_t ret; unsigned c = avio_rb32(pb); //avio_read() used int @@ -947,7 +948,12 @@ static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count) return AVERROR(ENOMEM); } avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ -avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID)); +ret = avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID)); +if (ret != *count * sizeof(UID)) { +*count = ret < 0 ? 0 : ret / sizeof(UID); +return ret < 0 ? ret : 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 count in mxf_read_strong_ref_array()
ffmpeg | branch: master | Michael Niedermayer | Sun Mar 13 00:34:52 2022 +0100| [3015c556f316d4ab364ed55e8bc97cc0f2cc57a3] | committer: Michael Niedermayer avformat/mxfdec: Check count in mxf_read_strong_ref_array() Reviewed-by: Tomas Härdin Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3015c556f316d4ab364ed55e8bc97cc0f2cc57a3 --- libavformat/mxfdec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index a32c1c55a4..a858bbb7be 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -933,7 +933,13 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count) { -*count = avio_rb32(pb); +unsigned c = avio_rb32(pb); + +//avio_read() used int +if (c > INT_MAX / sizeof(UID)) +return AVERROR_PATCHWELCOME; +*count = c; + av_free(*refs); *refs = av_calloc(*count, sizeof(UID)); if (!*refs) { ___ 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/av1dec: Check tile_cols
ffmpeg | branch: master | Michael Niedermayer | Tue Feb 1 18:42:34 2022 +0100| [4fdfe430c12225e819f68993474bd2f473c7e8b1] | committer: Michael Niedermayer avcodec/av1dec: Check tile_cols Fixes: division by zero Fixes: 43769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5392562205097984 Fixes: 43950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5769210217758720 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=4fdfe430c12225e819f68993474bd2f473c7e8b1 --- libavcodec/av1dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index a274d8867e..613efc5d11 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -398,6 +398,9 @@ static int get_tiles_info(AVCodecContext *avctx, const AV1RawTileGroup *tile_gro s->tg_start = tile_group->tg_start; s->tg_end = tile_group->tg_end; +if (s->raw_frame_header->tile_cols == 0) +return AVERROR_INVALIDDATA; + for (tile_num = tile_group->tg_start; tile_num <= tile_group->tg_end; tile_num++) { tile_row = tile_num / s->raw_frame_header->tile_cols; tile_col = tile_num % s->raw_frame_header->tile_cols; ___ 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/allcodecs: Dont play with NULLs
ffmpeg | branch: master | Michael Niedermayer | Mon Mar 21 21:19:43 2022 +0100| [dd1ce72e68f77c88fe8d258d83f7315c34b1eb11] | committer: Michael Niedermayer avcodec/allcodecs: Dont play with NULLs Fixes: member access within null pointer of type 'const FFCodec' (aka 'const struct FFCodec') Fixes: 45726/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6554445419249664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd1ce72e68f77c88fe8d258d83f7315c34b1eb11 --- libavcodec/allcodecs.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b1aa7e266b..22d56760ec 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -882,10 +882,11 @@ const AVCodec *av_codec_iterate(void **opaque) ff_thread_once(_codec_static_init, av_codec_init_static); -if (c) +if (c) { *opaque = (void*)(i + 1); - -return >p; +return >p; +} +return NULL; } static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) ___ 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/wmaprodec: ensure channel count in the private context and decoder context are consistent
ffmpeg | branch: master | James Almer | Thu Mar 17 22:04:35 2022 -0300| [6bab6afecc513bfd242b5992547e8050cac8f95c] | committer: James Almer avcodec/wmaprodec: ensure channel count in the private context and decoder context are consistent avctx->ch_layout will be reinitialized using channel_mask later in the function. Fixes: 45736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5769886813519872 Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6bab6afecc513bfd242b5992547e8050cac8f95c --- libavcodec/wmaprodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index a2ee9b0440..8e1675dc78 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -403,7 +403,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu s->decode_flags= AV_RL16(edata_ptr+14); channel_mask = AV_RL32(edata_ptr+2); s->bits_per_sample = AV_RL16(edata_ptr); -s->nb_channels = avctx->ch_layout.nb_channels; +s->nb_channels = channel_mask ? av_popcount(channel_mask) : avctx->ch_layout.nb_channels; if (s->bits_per_sample > 32 || s->bits_per_sample < 1) { avpriv_request_sample(avctx, "bits per sample is %d", s->bits_per_sample); ___ 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/demux: ensure ch_layout is not lost in the stream's internal avctx
ffmpeg | branch: master | James Almer | Mon Mar 21 08:48:19 2022 -0300| [37f44406829d477e27aa9440327b86b4355cf6c9] | committer: James Almer avformat/demux: ensure ch_layout is not lost in the stream's internal avctx This is a workaround until avcodec_close() stops freeing ch_layout through av_opt_fre(), or the former is removed. Fixes a regression since 327efa66331ebdc0087c6b656059a8df2f404019. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37f44406829d477e27aa9440327b86b4355cf6c9 --- libavformat/demux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/demux.c b/libavformat/demux.c index c1c9422ac0..ac1f16edcd 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -2957,6 +2957,9 @@ find_stream_info_err: av_freep(>info); } avcodec_close(sti->avctx); +// FIXME: avcodec_close() frees AVOption settable fields which includes ch_layout, +//so we need to restore it. +av_channel_layout_copy(>avctx->ch_layout, >codecpar->ch_layout); av_bsf_free(>extract_extradata.bsf); } if (ic->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] doc/bitstream_filters: add missing options in h264_metadata
ffmpeg | branch: master | Gyan Doshi | Mon Mar 21 16:15:16 2022 +0530| [505a7d39cd9990428899241a017ef523e236b9ca] | committer: Gyan Doshi doc/bitstream_filters: add missing options in h264_metadata > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=505a7d39cd9990428899241a017ef523e236b9ca --- doc/bitstream_filters.texi | 35 +++ 1 file changed, 35 insertions(+) diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index 8c5d84dceb..0b354fda04 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -247,12 +247,16 @@ Modify metadata embedded in an H.264 stream. Insert or remove AUD NAL units in all access units of the stream. @table @samp +@item pass @item insert @item remove @end table +Default is pass. + @item sample_aspect_ratio Set the sample aspect ratio of the stream in the VUI parameters. +See H.264 table E-1. @item overscan_appropriate_flag Set whether the stream is suitable for display using overscan @@ -311,6 +315,37 @@ insert the string ``hello'' associated with the given UUID. @item delete_filler Deletes both filler NAL units and filler SEI messages. +@item display_orientation +Insert, extract or remove Display orientation SEI messages. +See H.264 section D.1.27 and D.2.27 for syntax and semantics. + +@table @samp +@item pass +@item insert +@item remove +@item extract +@end table + +Default is pass. + +Insert mode works in conjunction with @code {rotate} and @code{flip} options. +Any pre-existing Display orientation messages will be removed in insert or remove mode. +Extract mode attaches the display matrix to the packet as side data. + +@item rotate +Set rotation in display orientation SEI (anticlockwise angle in degrees). +Range is -360 to +360. Default is NaN. + +@item flip +Set flip in display orientation SEI. + +@table @samp +@item horizontal +@item vertical +@end table + +Default is unset. + @item level Set the level in the SPS. Refer to H.264 section A.3 and tables A-1 to A-5. ___ 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/hls: Check target_duration
ffmpeg | branch: master | Michael Niedermayer | Sun Mar 20 22:54:31 2022 +0100| [a8fd3f7fab83e1beea1c441e1a2e538e7aa431a5] | committer: Michael Niedermayer avformat/hls: Check target_duration Fixes: signed integer overflow: 77 * 100 cannot be represented in type 'long long' Fixes: 45545/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-6438101247983616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Steven Liu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a8fd3f7fab83e1beea1c441e1a2e538e7aa431a5 --- libavformat/hls.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 1a1b40abe4..0541d3c610 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -819,10 +819,16 @@ static int parse_playlist(HLSContext *c, const char *url, ); new_rendition(c, , url); } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", )) { +int64_t t; ret = ensure_playlist(c, , url); if (ret < 0) goto fail; -pls->target_duration = strtoll(ptr, NULL, 10) * AV_TIME_BASE; +t = strtoll(ptr, NULL, 10); +if (t < 0 || t >= INT64_MAX / AV_TIME_BASE) { +ret = AVERROR_INVALIDDATA; +goto fail; +} +pls->target_duration = t * AV_TIME_BASE; } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", )) { uint64_t seq_no; ret = ensure_playlist(c, , url); ___ 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/pixlet: Avoid signed integer overflow in scaling in filterfn()
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 26 21:30:19 2020 +0100| [0c1f20c6c858b753effda274b58ef635d1924915] | committer: Michael Niedermayer avcodec/pixlet: Avoid signed integer overflow in scaling in filterfn() Fixes: signed integer overflow: 11494 * 107374182400 cannot be represented in type 'long' Fixes: 26586/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5752633970917376 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=0c1f20c6c858b753effda274b58ef635d1924915 --- libavcodec/pixlet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c index daa3383fcc..9b61a8b1cd 100644 --- a/libavcodec/pixlet.c +++ b/libavcodec/pixlet.c @@ -406,7 +406,7 @@ static void filterfn(int16_t *dest, int16_t *tmp, unsigned size, int64_t scale) (int64_t) low [i - 1] * -INT64_C(325392907) + (int64_t) high[i + 0] * INT64_C(1518500249) + (int64_t) high[i - 1] * INT64_C(1518500249); -dest[i * 2] = av_clip_int16(((value >> 32) * scale) >> 32); +dest[i * 2] = av_clip_int16(((value >> 32) * (uint64_t)scale) >> 32); } for (i = 0; i < hsize; i++) { @@ -417,7 +417,7 @@ static void filterfn(int16_t *dest, int16_t *tmp, unsigned size, int64_t scale) (int64_t) high[i + 1] * INT64_C(303700064) + (int64_t) high[i + 0] * -INT64_C(3644400640) + (int64_t) high[i - 1] * INT64_C(303700064); -dest[i * 2 + 1] = av_clip_int16(((value >> 32) * scale) >> 32); +dest[i * 2 + 1] = av_clip_int16(((value >> 32) * (uint64_t)scale) >> 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] avcodec/mlpdec: Use 64bit for channel layout
ffmpeg | branch: master | Michael Niedermayer | Mon Mar 21 00:30:53 2022 +0100| [23e27a360e47b7c7825f3df22c6013d5066829e3] | committer: Michael Niedermayer avcodec/mlpdec: Use 64bit for channel layout Fixes: shift exponent 33 is too large for 32-bit type 'int' Fixes: 45645/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5651350182035456 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=23e27a360e47b7c7825f3df22c6013d5066829e3 --- libavcodec/mlpdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index e3fbaa62c7..5a4d272f78 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -208,7 +208,7 @@ static enum AVChannel thd_channel_layout_extract_channel(uint64_t channel_layout return AV_CHAN_NONE; for (i = 0; i < FF_ARRAY_ELEMS(thd_channel_order); i++) -if (channel_layout & (1 << thd_channel_order[i]) && !index--) +if (channel_layout & (1ULL << thd_channel_order[i]) && !index--) return thd_channel_order[i]; return AV_CHAN_NONE; } ___ 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".