[FFmpeg-devel] [PATCH] avformat/dashdec: accept and relay CENC decryption key
Allows to process CENC-encrypted media segments. Option arg syntax is same as that for option decryption_key in MOV demuxer --- doc/demuxers.texi | 11 +++ libavformat/dashdec.c | 5 + 2 files changed, 16 insertions(+) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 238b8e03a8..c95a9ae594 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -274,6 +274,17 @@ which streams to actually receive. Each stream mirrors the @code{id} and @code{bandwidth} properties from the @code{} as metadata keys named "id" and "variant_bitrate" respectively. +@subsection Options + +This demuxer accepts the following option: + +@table @option + +@item cenc_decryption_key +16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7). + +@end table + @section imf Interoperable Master Format demuxer. diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 0b5ff5aeb9..0f66251354 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -150,6 +150,7 @@ typedef struct DASHContext { char *allowed_extensions; AVDictionary *avio_opts; int max_url_size; +char *cenc_decryption_key; /* Flags for init section*/ int is_init_section_common_video; @@ -1893,6 +1894,9 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation pls->ctx->pb = &pls->pb.pub; pls->ctx->io_open = nested_io_open; +if (c->cenc_decryption_key) +av_dict_set(&in_fmt_opts, "decryption_key", c->cenc_decryption_key, AV_OPT_FLAG_DECODING_PARAM); + // provide additional information from mpd if available ret = avformat_open_input(&pls->ctx, "", in_fmt, &in_fmt_opts); //pls->init_section->url av_dict_free(&in_fmt_opts); @@ -2344,6 +2348,7 @@ static const AVOption dash_options[] = { OFFSET(allowed_extensions), AV_OPT_TYPE_STRING, {.str = "aac,m4a,m4s,m4v,mov,mp4,webm,ts"}, INT_MIN, INT_MAX, FLAGS}, +{ "cenc_decryption_key", "Media decryption key (hex)", OFFSET(cenc_decryption_key), AV_OPT_TYPE_STRING, {.str = NULL}, INT_MIN, INT_MAX, .flags = FLAGS }, {NULL} }; -- 2.36.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/af_afir: add support for double sample format
Signed-off-by: Paul B Mahol --- doc/filters.texi| 16 ++ libavfilter/af_afir.c | 511 +++- libavfilter/af_afir.h | 99 +++ libavfilter/af_afirdsp.h| 20 ++ libavfilter/afir_template.c | 392 +++ 5 files changed, 623 insertions(+), 415 deletions(-) create mode 100644 libavfilter/af_afir.h create mode 100644 libavfilter/afir_template.c diff --git a/doc/filters.texi b/doc/filters.texi index 45ebcccf1c..da63403848 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1639,6 +1639,22 @@ Allowed range is from @var{1} to @var{32}. Default is @var{1}. Set IR stream which will be used for convolution, starting from @var{0}, should always be lower than supplied value by @code{nbirs} option. Default is @var{0}. This option can be changed at runtime via @ref{commands}. + +@item precision +Set which precision to use when processing samples. + +@table @option +@item auto +Auto pick internal sample format depending on other filters. + +@item float +Always use single-floating point precision sample format. + +@item double +Always use double-floating point precision sample format. +@end table + +Default value is auto. @end table @subsection Examples diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 301553575f..e1fe7d6a64 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -42,208 +42,78 @@ #include "filters.h" #include "formats.h" #include "internal.h" +#include "af_afir.h" #include "af_afirdsp.h" -typedef struct AudioFIRSegment { -int nb_partitions; -int part_size; -int block_size; -int fft_length; -int coeff_size; -int input_size; -int input_offset; - -int *output_offset; -int *part_index; - -AVFrame *sumin; -AVFrame *sumout; -AVFrame *blockin; -AVFrame *blockout; -AVFrame *buffer; -AVFrame *coeff; -AVFrame *input; -AVFrame *output; - -AVTXContext **tx, **itx; -av_tx_fn tx_fn, itx_fn; -} AudioFIRSegment; - -typedef struct AudioFIRContext { -const AVClass *class; - -float wet_gain; -float dry_gain; -float length; -int gtype; -float ir_gain; -int ir_format; -float max_ir_len; -int response; -int w, h; -AVRational frame_rate; -int ir_channel; -int minp; -int maxp; -int nb_irs; -int selir; - -float gain; - -int eof_coeffs[32]; -int have_coeffs; -int nb_taps; -int nb_channels; -int nb_coef_channels; -int one2many; - -AudioFIRSegment seg[1024]; -int nb_segments; - -AVFrame *in; -AVFrame *ir[32]; -AVFrame *video; -int min_part_size; -int64_t pts; +static void drawtext(AVFrame *pic, int x, int y, const char *txt, uint32_t color) +{ +const uint8_t *font; +int font_height; +int i; -AudioFIRDSPContext afirdsp; -AVFloatDSPContext *fdsp; -} AudioFIRContext; +font = avpriv_cga_font, font_height = 8; -static void direct(const float *in, const AVComplexFloat *ir, int len, float *out) -{ -for (int n = 0; n < len; n++) -for (int m = 0; m <= n; m++) -out[n] += ir[m].re * in[n - m]; -} +for (i = 0; txt[i]; i++) { +int char_y, mask; -static void fir_fadd(AudioFIRContext *s, float *dst, const float *src, int nb_samples) -{ -if ((nb_samples & 15) == 0 && nb_samples >= 16) { -s->fdsp->vector_fmac_scalar(dst, src, 1.f, nb_samples); -} else { -for (int n = 0; n < nb_samples; n++) -dst[n] += src[n]; +uint8_t *p = pic->data[0] + y * pic->linesize[0] + (x + i * 8) * 4; +for (char_y = 0; char_y < font_height; char_y++) { +for (mask = 0x80; mask; mask >>= 1) { +if (font[txt[i] * font_height + char_y] & mask) +AV_WL32(p, color); +p += 4; +} +p += pic->linesize[0] - 8 * 4; +} } } -static int fir_quantum(AVFilterContext *ctx, AVFrame *out, int ch, int offset) +static void draw_line(AVFrame *out, int x0, int y0, int x1, int y1, uint32_t color) { -AudioFIRContext *s = ctx->priv; -const float *in = (const float *)s->in->extended_data[ch] + offset; -float *blockin, *blockout, *buf, *ptr = (float *)out->extended_data[ch] + offset; -const int nb_samples = FFMIN(s->min_part_size, out->nb_samples - offset); -int n, i, j; - -for (int segment = 0; segment < s->nb_segments; segment++) { -AudioFIRSegment *seg = &s->seg[segment]; -float *src = (float *)seg->input->extended_data[ch]; -float *dst = (float *)seg->output->extended_data[ch]; -float *sumin = (float *)seg->sumin->extended_data[ch]; -float *sumout = (float *)seg->sumout->extended_data[ch]; - -if (s->min_part_size >= 8) { -s->fdsp->vector_fmul_scalar(src + seg->input_offset, in, s->dry_gain, FFALIGN(nb_samples, 4)); -emms_c(); -} else { -
Re: [FFmpeg-devel] [PATCH 1/1] fix: use declared size for attribute of type string to ensure full value used and prevent parse failure for string lengths longer than 256
On Thu, May 12, 2022 at 5:31 PM vectronic wrote: > Signed-off-by: vectronic > --- > libavcodec/exr.c | 32 +++- > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/libavcodec/exr.c b/libavcodec/exr.c > index 8cd867a32f..bc2afcee53 100644 > --- a/libavcodec/exr.c > +++ b/libavcodec/exr.c > @@ -1912,10 +1912,13 @@ static int decode_header(EXRContext *s, AVFrame > *frame) > continue; > } else if ((var_size = check_header_variable(s, "writer", > "string", 1)) >= 0) { > -uint8_t key[256] = { 0 }; > +uint8_t *key = av_malloc(var_size); > > -bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, > var_size)); > -av_dict_set(&metadata, "writer", key, 0); > +if (!key) > +return AVERROR(ENOMEM); > + > +bytestream2_get_buffer(gb, key, var_size); > +av_dict_set(&metadata, "writer", key, > AV_DICT_DONT_STRDUP_VAL); > var_size can be very big number, potentially causing attacks vectors. > > continue; > } else if ((var_size = check_header_variable(s, "framesPerSecond", > @@ -1937,9 +1940,12 @@ static int decode_header(EXRContext *s, AVFrame > *frame) > continue; > } else if ((var_size = check_header_variable(s, "type", > "string", 16)) >= 0) > { > -uint8_t key[256] = { 0 }; > +uint8_t *key = av_malloc(var_size); > + > +if (!key) > +return AVERROR(ENOMEM); > > -bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, > var_size)); > +bytestream2_get_buffer(gb, key, var_size); > if (strncmp("scanlineimage", key, var_size) && > strncmp("tiledimage", key, var_size)) > return AVERROR_PATCHWELCOME; > @@ -1970,7 +1976,6 @@ static int decode_header(EXRContext *s, AVFrame > *frame) > { > uint8_t name[256] = { 0 }; > uint8_t type[256] = { 0 }; > -uint8_t value[256] = { 0 }; > int i = 0, size; > > while (bytestream2_get_bytes_left(gb) > 0 && > @@ -1987,9 +1992,18 @@ static int decode_header(EXRContext *s, AVFrame > *frame) > bytestream2_skip(gb, 1); > size = bytestream2_get_le32(gb); > > -bytestream2_get_buffer(gb, value, FFMIN(sizeof(value) - 1, > size)); > -if (!strcmp(type, "string")) > -av_dict_set(&metadata, name, value, 0); > +if (strcmp(type, "string") != 0) { > +bytestream2_skip(gb, size); > + > +continue; > +} > +uint8_t *value = av_malloc(size); > + > +if (!value) > +return AVERROR(ENOMEM); > + > +bytestream2_get_buffer(gb, value, size); > +av_dict_set(&metadata, name, value, AV_DICT_DONT_STRDUP_VAL); > } > } > > -- > 2.32.0 (Apple Git-132) > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/dashdec: accept and relay CENC decryption key
Gyan Doshi 于2022年5月14日周六 17:18写道: > > Allows to process CENC-encrypted media segments. > Option arg syntax is same as that for option decryption_key in MOV demuxer > --- > doc/demuxers.texi | 11 +++ > libavformat/dashdec.c | 5 + > 2 files changed, 16 insertions(+) > > diff --git a/doc/demuxers.texi b/doc/demuxers.texi > index 238b8e03a8..c95a9ae594 100644 > --- a/doc/demuxers.texi > +++ b/doc/demuxers.texi > @@ -274,6 +274,17 @@ which streams to actually receive. > Each stream mirrors the @code{id} and @code{bandwidth} properties from the > @code{} as metadata keys named "id" and "variant_bitrate" > respectively. > > +@subsection Options > + > +This demuxer accepts the following option: > + > +@table @option > + > +@item cenc_decryption_key > +16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption > (CENC/AES-128 CTR; ISO/IEC 23001-7). > + > +@end table > + > @section imf > > Interoperable Master Format demuxer. > diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c > index 0b5ff5aeb9..0f66251354 100644 > --- a/libavformat/dashdec.c > +++ b/libavformat/dashdec.c > @@ -150,6 +150,7 @@ typedef struct DASHContext { > char *allowed_extensions; > AVDictionary *avio_opts; > int max_url_size; > +char *cenc_decryption_key; > > /* Flags for init section*/ > int is_init_section_common_video; > @@ -1893,6 +1894,9 @@ static int reopen_demux_for_component(AVFormatContext > *s, struct representation > pls->ctx->pb = &pls->pb.pub; > pls->ctx->io_open = nested_io_open; > > +if (c->cenc_decryption_key) > +av_dict_set(&in_fmt_opts, "decryption_key", c->cenc_decryption_key, > AV_OPT_FLAG_DECODING_PARAM); > + > // provide additional information from mpd if available > ret = avformat_open_input(&pls->ctx, "", in_fmt, &in_fmt_opts); > //pls->init_section->url > av_dict_free(&in_fmt_opts); > @@ -2344,6 +2348,7 @@ static const AVOption dash_options[] = { > OFFSET(allowed_extensions), AV_OPT_TYPE_STRING, > {.str = "aac,m4a,m4s,m4v,mov,mp4,webm,ts"}, > INT_MIN, INT_MAX, FLAGS}, > +{ "cenc_decryption_key", "Media decryption key (hex)", > OFFSET(cenc_decryption_key), AV_OPT_TYPE_STRING, {.str = NULL}, INT_MIN, > INT_MAX, .flags = FLAGS }, > {NULL} > }; > > -- > 2.36.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". LGTM Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/dashdec: accept and relay CENC decryption key
On 2022-05-14 04:08 pm, Steven Liu wrote: Gyan Doshi 于2022年5月14日周六 17:18写道: Allows to process CENC-encrypted media segments. Option arg syntax is same as that for option decryption_key in MOV demuxer --- doc/demuxers.texi | 11 +++ libavformat/dashdec.c | 5 + 2 files changed, 16 insertions(+) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 238b8e03a8..c95a9ae594 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -274,6 +274,17 @@ which streams to actually receive. Each stream mirrors the @code{id} and @code{bandwidth} properties from the @code{} as metadata keys named "id" and "variant_bitrate" respectively. +@subsection Options + +This demuxer accepts the following option: + +@table @option + +@item cenc_decryption_key +16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7). + +@end table + @section imf Interoperable Master Format demuxer. diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 0b5ff5aeb9..0f66251354 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -150,6 +150,7 @@ typedef struct DASHContext { char *allowed_extensions; AVDictionary *avio_opts; int max_url_size; +char *cenc_decryption_key; /* Flags for init section*/ int is_init_section_common_video; @@ -1893,6 +1894,9 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation pls->ctx->pb = &pls->pb.pub; pls->ctx->io_open = nested_io_open; +if (c->cenc_decryption_key) +av_dict_set(&in_fmt_opts, "decryption_key", c->cenc_decryption_key, AV_OPT_FLAG_DECODING_PARAM); + // provide additional information from mpd if available ret = avformat_open_input(&pls->ctx, "", in_fmt, &in_fmt_opts); //pls->init_section->url av_dict_free(&in_fmt_opts); @@ -2344,6 +2348,7 @@ static const AVOption dash_options[] = { OFFSET(allowed_extensions), AV_OPT_TYPE_STRING, {.str = "aac,m4a,m4s,m4v,mov,mp4,webm,ts"}, INT_MIN, INT_MAX, FLAGS}, +{ "cenc_decryption_key", "Media decryption key (hex)", OFFSET(cenc_decryption_key), AV_OPT_TYPE_STRING, {.str = NULL}, INT_MIN, INT_MAX, .flags = FLAGS }, {NULL} }; -- 2.36.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". LGTM Pushed as 8b64d8d9aa7fede94ab531b7be3f73cd2f3c448c Thanks, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] fftools/opt_common: add missing include of avf/version.h
From: softworkz required for PRINT_LIB_INFO(avfilter... Signed-off-by: softworkz --- fftools/opt_common: add missing include of avf/version.h MSVC compiler complains without this include v2: also include avfilter.h as suggested Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-27%2Fsoftworkz%2Fsubmit_version_include-v2 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-27/softworkz/submit_version_include-v2 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/27 Range-diff vs v1: 1: db6ab867b4 ! 1: f011be1049 fftools/opt_common: add missing include of avf/version.h @@ fftools/opt_common.c #include "libavdevice/avdevice.h" #include "libavdevice/version.h" ++#include "libavfilter/avfilter.h" +#include "libavfilter/version.h" + #include "libswscale/swscale.h" fftools/opt_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fftools/opt_common.c b/fftools/opt_common.c index c303db4d09..55d86eeb19 100644 --- a/fftools/opt_common.c +++ b/fftools/opt_common.c @@ -51,6 +51,9 @@ #include "libavdevice/avdevice.h" #include "libavdevice/version.h" +#include "libavfilter/avfilter.h" +#include "libavfilter/version.h" + #include "libswscale/swscale.h" #include "libswscale/version.h" base-commit: b90341d1d5585b7181873ac4d85a7c373eb3b2ae -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avutil/csp: create public API for colorspace structs
Hi, If you push the code somewhere I can take a stab at porting it to AVRational. On Fri, 13 May 2022 22:41:15 -0400 Leo Izen wrote: > On 5/13/22 17:22, Michael Niedermayer wrote: > > On Fri, May 13, 2022 at 11:42:08AM -0400, Leo Izen wrote: > >> + > >> +struct WhitepointCoefficients { > >> +double xw, yw; > >> +}; > > I think we should avoid floating point so as to ensure reproduceable > > results and simplify regerssion testing > > > > thx > This code already exists in master right now in libavfilter/colorspace, > so changing these from floats to AVRational would require a bit more > work than just a movement. > > - Leo Izen (thebombzen) > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 00/10] libavformat/asf: fix handling of byte array length values
The spec allows attachment sizes of up to UINT32_MAX while we can handle only sizes up to INT32_MAX (in downstream code) The debug.assert in get_tag didn't really address this, and truncating the value_len in calling methods cannot be used because the length value is required in order to continue parsing. This adds a check with log message in ff_asf_handle_byte_array to handle those (rare) cases. v2: Rebased & PING v3: Adjustments suggested by Michael v4: 1 of 11 merged, 10 to go.. softworkz (10): libavformat/asf: fix handling of byte array length values libavformat/asfdec: fix get_value return type and add checks for libavformat/asfdec: fix type of value_len libavformat/asfdec: fixing get_tag libavformat/asfdec: implement parsing of GUID values libavformat/asfdec: fix macro definition and use libavformat/asfdec: remove variable redefinition in inner scope libavformat/asfdec: ensure variables are initialized libavformat/asfdec: fix parameter type in asf_read_stream_propertie() libavformat/asfdec: fix variable types and add checks for unsupported values libavformat/asf.c | 8 +- libavformat/asf.h | 2 +- libavformat/asfdec_f.c | 338 +++-- 3 files changed, 229 insertions(+), 119 deletions(-) base-commit: e6f0cec88041449475f37b82b76699d2f7b5b124 Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-12%2Fsoftworkz%2Fmaster-upstream_asf_4-v4 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-12/softworkz/master-upstream_asf_4-v4 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/12 Range-diff vs v3: 1: b5c56bf5d0 = 1: 60966b7907 libavformat/asf: fix handling of byte array length values 2: e6aa0fb7f3 ! 2: 5acab7b52b libavformat/asfdec: fix get_value return type and add checks for @@ libavformat/asfdec_f.c: static int asf_probe(const AVProbeData *pd) { switch (type) { case ASF_BOOL: -@@ libavformat/asfdec_f.c: static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) +@@ libavformat/asfdec_f.c: static int asf_read_ext_content_desc(AVFormatContext *s) { AVIOContext *pb = s->pb; ASFContext *asf = s->priv_data; @@ libavformat/asfdec_f.c: static int asf_read_ext_content_desc(AVFormatContext *s, int desc_count, i, ret; desc_count = avio_rl16(pb); -@@ libavformat/asfdec_f.c: static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) +@@ libavformat/asfdec_f.c: static int asf_read_ext_content_desc(AVFormatContext *s) /* My sample has that stream set to 0 maybe that mean the container. * ASF stream count starts at 1. I am using 0 to the container value * since it's unused. */ @@ libavformat/asfdec_f.c: static int asf_read_ext_content_desc(AVFormatContext *s, return 0; } -@@ libavformat/asfdec_f.c: static int asf_read_metadata(AVFormatContext *s, int64_t size) +@@ libavformat/asfdec_f.c: static int asf_read_metadata(AVFormatContext *s) { AVIOContext *pb = s->pb; ASFContext *asf = s->priv_data; @@ libavformat/asfdec_f.c: static int asf_read_metadata(AVFormatContext *s, int64_t int n, stream_num, name_len_utf16, name_len_utf8, value_len; int ret, i; n = avio_rl16(pb); -@@ libavformat/asfdec_f.c: static int asf_read_metadata(AVFormatContext *s, int64_t size) +@@ libavformat/asfdec_f.c: static int asf_read_metadata(AVFormatContext *s) av_log(s, AV_LOG_TRACE, "%d stream %d name_len %2d type %d len %4d <%s>\n", i, stream_num, name_len_utf16, value_type, value_len, name); 3: b84474d729 ! 3: 97e0d765c9 libavformat/asfdec: fix type of value_len @@ libavformat/asfdec_f.c: static uint64_t get_value(AVIOContext *pb, int type, int { ASFContext *asf = s->priv_data; char *value = NULL; -@@ libavformat/asfdec_f.c: static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) - static int asf_read_content_desc(AVFormatContext *s, int64_t size) +@@ libavformat/asfdec_f.c: static int asf_read_ext_stream_properties(AVFormatContext *s) + static int asf_read_content_desc(AVFormatContext *s) { AVIOContext *pb = s->pb; -int len1, len2, len3, len4, len5; @@ libavformat/asfdec_f.c: static int asf_read_ext_stream_properties(AVFormatContex len1 = avio_rl16(pb); len2 = avio_rl16(pb); -@@ libavformat/asfdec_f.c: static int asf_read_metadata(AVFormatContext *s, int64_t size) +@@ libavformat/asfdec_f.c: static int asf_read_metadata(AVFormatContext *s) ASFContext *asf = s->priv_data; uint64_t dar_num[128] = {0}; uint64_t dar_den[128] = {0}; 4: a54feb51a1 = 4: 025
[FFmpeg-devel] [PATCH v4 01/10] libavformat/asf: fix handling of byte array length values
From: softworkz The spec allows attachment sizes of up to UINT32_MAX while we can handle only sizes up to INT32_MAX (in downstream code) The debug.assert in get_tag didn't really address this, and truncating the value_len in calling methods cannot be used because the length value is required in order to continue parsing. This adds a check with log message in ff_asf_handle_byte_array to handle those (rare) cases. Signed-off-by: softworkz --- libavformat/asf.c | 8 +++- libavformat/asf.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavformat/asf.c b/libavformat/asf.c index 1285062220..bec7db0c7e 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -139,12 +139,18 @@ static int get_id3_tag(AVFormatContext *s, int len) } int ff_asf_handle_byte_array(AVFormatContext *s, const char *name, - int val_len) + uint32_t val_len) { +if (val_len > INT32_MAX) { +av_log(s, AV_LOG_VERBOSE, "Unable to handle byte arrays > INT32_MAX in tag %s.\n", name); +return 1; +} + if (!strcmp(name, "WM/Picture")) // handle cover art return asf_read_picture(s, val_len); else if (!strcmp(name, "ID3")) // handle ID3 tag return get_id3_tag(s, val_len); +av_log(s, AV_LOG_DEBUG, "Unsupported byte array in tag %s.\n", name); return 1; } diff --git a/libavformat/asf.h b/libavformat/asf.h index 01cc4f7a46..4d28560f56 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -111,7 +111,7 @@ extern const AVMetadataConv ff_asf_metadata_conv[]; * is unsupported by this function and 0 otherwise. */ int ff_asf_handle_byte_array(AVFormatContext *s, const char *name, - int val_len); + uint32_t val_len); #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 02/10] libavformat/asfdec: fix get_value return type and add checks for
From: softworkz unsupported values get_value had a return type of int, which means that reading QWORDS (case 4) was broken due to truncation of the result from avio_rl64(). Signed-off-by: softworkz --- libavformat/asfdec_f.c | 57 +++--- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 4770a812db..c7c4ba55d6 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -203,7 +203,7 @@ static int asf_probe(const AVProbeData *pd) /* size of type 2 (BOOL) is 32bit for "Extended Content Description Object" * but 16 bit for "Metadata Object" and "Metadata Library Object" */ -static int get_value(AVIOContext *pb, int type, int type2_size) +static uint64_t get_value(AVIOContext *pb, int type, int type2_size) { switch (type) { case ASF_BOOL: @@ -549,6 +549,8 @@ static int asf_read_ext_content_desc(AVFormatContext *s) { AVIOContext *pb = s->pb; ASFContext *asf = s->priv_data; +uint64_t dar_num = 0; +uint64_t dar_den = 0; int desc_count, i, ret; desc_count = avio_rl16(pb); @@ -568,14 +570,27 @@ static int asf_read_ext_content_desc(AVFormatContext *s) /* My sample has that stream set to 0 maybe that mean the container. * ASF stream count starts at 1. I am using 0 to the container value * since it's unused. */ -if (!strcmp(name, "AspectRatioX")) -asf->dar[0].num = get_value(s->pb, value_type, 32); -else if (!strcmp(name, "AspectRatioY")) -asf->dar[0].den = get_value(s->pb, value_type, 32); +if (!strcmp(name, "AspectRatioX")) { +dar_num = get_value(s->pb, value_type, 32); +if (dar_num > INT64_MAX) { +av_log(s, AV_LOG_DEBUG, "Unsupported AspectRatioX value: %"PRIu64"\n", dar_num); +return AVERROR(ENOTSUP); +} +} +else if (!strcmp(name, "AspectRatioY")) { +dar_den = get_value(s->pb, value_type, 32); +if (dar_den > INT64_MAX) { +av_log(s, AV_LOG_DEBUG, "Unsupported AspectRatioY value: %"PRIu64"\n", dar_den); +return AVERROR(ENOTSUP); +} +} else get_tag(s, name, value_type, value_len, 32); } +if (dar_num && dar_den) +av_reduce(&asf->dar[0].num, &asf->dar[0].den, dar_num, dar_den, INT_MAX); + return 0; } @@ -603,6 +618,8 @@ static int asf_read_metadata(AVFormatContext *s) { AVIOContext *pb = s->pb; ASFContext *asf = s->priv_data; +uint64_t dar_num[128] = {0}; +uint64_t dar_den[128] = {0}; int n, stream_num, name_len_utf16, name_len_utf8, value_len; int ret, i; n = avio_rl16(pb); @@ -630,17 +647,29 @@ static int asf_read_metadata(AVFormatContext *s) av_log(s, AV_LOG_TRACE, "%d stream %d name_len %2d type %d len %4d <%s>\n", i, stream_num, name_len_utf16, value_type, value_len, name); -if (!strcmp(name, "AspectRatioX")){ -int aspect_x = get_value(s->pb, value_type, 16); -if(stream_num < 128) -asf->dar[stream_num].num = aspect_x; -} else if(!strcmp(name, "AspectRatioY")){ -int aspect_y = get_value(s->pb, value_type, 16); -if(stream_num < 128) -asf->dar[stream_num].den = aspect_y; -} else { +if (!strcmp(name, "AspectRatioX") && stream_num < 128) { +dar_num[stream_num] = get_value(s->pb, value_type, 16); +if (dar_num[stream_num] > INT64_MAX) { +av_log(s, AV_LOG_DEBUG, "Unsupported AspectRatioX value: %"PRIu64"\n", dar_num[stream_num]); +return AVERROR(ENOTSUP); +} +} +else if (!strcmp(name, "AspectRatioY") && stream_num < 128) { +dar_den[stream_num] = get_value(s->pb, value_type, 16); +if (dar_den[stream_num] > INT64_MAX) { +av_log(s, AV_LOG_DEBUG, "Unsupported AspectRatioY value: %"PRIu64"\n", dar_den[stream_num]); +return AVERROR(ENOTSUP); +} +} else get_tag(s, name, value_type, value_len, 16); + + +if (stream_num < 128 && dar_num[stream_num] && dar_den[stream_num]) { +av_reduce(&asf->dar[stream_num].num, &asf->dar[stream_num].den, dar_num[stream_num], dar_den[stream_num], INT_MAX); +dar_num[stream_num] = 0; +dar_den[stream_num] = 0; } + av_freep(&name); } -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 03/10] libavformat/asfdec: fix type of value_len
From: softworkz The value_len is an uint32 not an int32 per spec. That value must not be truncated, neither by casting to int, nor by any conditional checks, because at the end of get_tag, this value is needed to move forward in parsing. When the len value gets modified, the parsing may break. Signed-off-by: softworkz --- libavformat/asfdec_f.c | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index c7c4ba55d6..eda7175c96 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -219,7 +219,7 @@ static uint64_t get_value(AVIOContext *pb, int type, int type2_size) } } -static void get_tag(AVFormatContext *s, const char *key, int type, int len, int type2_size) +static void get_tag(AVFormatContext *s, const char *key, int type, uint32_t len, int type2_size) { ASFContext *asf = s->priv_data; char *value = NULL; @@ -529,7 +529,7 @@ static int asf_read_ext_stream_properties(AVFormatContext *s) static int asf_read_content_desc(AVFormatContext *s) { AVIOContext *pb = s->pb; -int len1, len2, len3, len4, len5; +uint32_t len1, len2, len3, len4, len5; len1 = avio_rl16(pb); len2 = avio_rl16(pb); @@ -620,25 +620,23 @@ static int asf_read_metadata(AVFormatContext *s) ASFContext *asf = s->priv_data; uint64_t dar_num[128] = {0}; uint64_t dar_den[128] = {0}; -int n, stream_num, name_len_utf16, name_len_utf8, value_len; +int n, name_len_utf8; +uint16_t stream_num, name_len_utf16, value_type; +uint32_t value_len; int ret, i; n = avio_rl16(pb); for (i = 0; i < n; i++) { uint8_t *name; -int value_type; avio_rl16(pb); // lang_list_index -stream_num = avio_rl16(pb); -name_len_utf16 = avio_rl16(pb); -value_type = avio_rl16(pb); /* value_type */ -value_len = avio_rl32(pb); +stream_num = (uint16_t)avio_rl16(pb); +name_len_utf16 = (uint16_t)avio_rl16(pb); +value_type = (uint16_t)avio_rl16(pb); /* value_type */ +value_len = avio_rl32(pb); -if (value_len < 0 || value_len > UINT16_MAX) -return AVERROR_INVALIDDATA; - -name_len_utf8 = 2*name_len_utf16 + 1; -name = av_malloc(name_len_utf8); +name_len_utf8 = 2 * name_len_utf16 + 1; +name = av_malloc(name_len_utf8); if (!name) return AVERROR(ENOMEM); -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 04/10] libavformat/asfdec: fixing get_tag
From: softworkz These three are closely related and can't be separated easily: In get_tag, the code was adding 22 bytes (in order to allow it to hold 64bit numbers as string) to the value len for creating creating a buffer. This was unnecessarily imposing a size-constraint on the value_len parameter. The code in get_tag, was limiting the maximum value_len to half the size of INT32. This was applied for all value types, even though it is required only in case of ASF_UNICODE, not for any other ones (like ASCII). get_tag was always allocating a buffer regardless of the datatype, even though this isn't required in case of ASF_BYTE_ARRAY The check for the return value from ff_asf_handle_byte_array() being >0 is removed here because the log message is emitted by the function itself now. Signed-off-by: softworkz --- libavformat/asfdec_f.c | 54 +++--- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index eda7175c96..cb7da2d679 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -222,37 +222,63 @@ static uint64_t get_value(AVIOContext *pb, int type, int type2_size) static void get_tag(AVFormatContext *s, const char *key, int type, uint32_t len, int type2_size) { ASFContext *asf = s->priv_data; -char *value = NULL; int64_t off = avio_tell(s->pb); -#define LEN 22 - -av_assert0((unsigned)len < (INT_MAX - LEN) / 2); +char *value = NULL; +uint64_t required_bufferlen; +int buffer_len; if (!asf->export_xmp && !strncmp(key, "xmp", 3)) goto finish; -value = av_malloc(2 * len + LEN); +switch (type) { +case ASF_UNICODE: +required_bufferlen = (uint64_t)len * 2 + 1; +break; +case -1: // ASCII +required_bufferlen = (uint64_t)len + 1; +break; +case ASF_BYTE_ARRAY: +ff_asf_handle_byte_array(s, key, len); +goto finish; +case ASF_BOOL: +case ASF_DWORD: +case ASF_QWORD: +case ASF_WORD: +required_bufferlen = 22; +break; +case ASF_GUID: +required_bufferlen = 33; +break; +default: +required_bufferlen = len; +break; +} + +if (required_bufferlen > INT32_MAX) { +av_log(s, AV_LOG_VERBOSE, "Unable to handle values > INT32_MAX in tag %s.\n", key); +goto finish; +} + +buffer_len = (int)required_bufferlen; + +value = av_malloc(buffer_len); if (!value) goto finish; switch (type) { case ASF_UNICODE: -avio_get_str16le(s->pb, len, value, 2 * len + 1); +avio_get_str16le(s->pb, len, value, buffer_len); break; -case -1: // ASCI -avio_read(s->pb, value, len); -value[len]=0; +case -1: // ASCII +avio_read(s->pb, value, buffer_len - 1); +value[buffer_len - 1] = 0; break; -case ASF_BYTE_ARRAY: -if (ff_asf_handle_byte_array(s, key, len) > 0) -av_log(s, AV_LOG_VERBOSE, "Unsupported byte array in tag %s.\n", key); -goto finish; case ASF_BOOL: case ASF_DWORD: case ASF_QWORD: case ASF_WORD: { uint64_t num = get_value(s->pb, type, type2_size); -snprintf(value, LEN, "%"PRIu64, num); +snprintf(value, buffer_len, "%"PRIu64, num); break; } case ASF_GUID: -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 05/10] libavformat/asfdec: implement parsing of GUID values
From: softworkz Signed-off-by: softworkz --- libavformat/asfdec_f.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index cb7da2d679..81a29f99d5 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -281,9 +281,12 @@ static void get_tag(AVFormatContext *s, const char *key, int type, uint32_t len, snprintf(value, buffer_len, "%"PRIu64, num); break; } -case ASF_GUID: -av_log(s, AV_LOG_DEBUG, "Unsupported GUID value in tag %s.\n", key); -goto finish; +case ASF_GUID: { +ff_asf_guid g; +ff_get_guid(s->pb, &g); +snprintf(value, buffer_len, "%x", g[0]); +break; +} default: av_log(s, AV_LOG_DEBUG, "Unsupported value type %d in tag %s.\n", type, key); -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 10/10] libavformat/asfdec: fix variable types and add checks for unsupported values
From: softworkz Signed-off-by: softworkz --- libavformat/asfdec_f.c | 168 ++--- 1 file changed, 108 insertions(+), 60 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 95cab8b960..d50682b901 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -333,9 +333,9 @@ static int asf_read_stream_properties(AVFormatContext *s, uint64_t size) ASFStream *asf_st; ff_asf_guid g; enum AVMediaType type; -int type_specific_size, sizeX; -unsigned int tag1; -int64_t pos1, pos2, start_time; +unsigned int tag1, type_specific_size, sizeX; +int64_t pos1, pos2; +uint32_t start_time; int test_for_ext_stream_audio, is_dvr_ms_audio = 0; if (s->nb_streams == ASF_MAX_STREAMS) { @@ -404,7 +404,14 @@ static int asf_read_stream_properties(AVFormatContext *s, uint64_t size) st->codecpar->codec_type = type; if (type == AVMEDIA_TYPE_AUDIO) { -int ret = ff_get_wav_header(s, pb, st->codecpar, type_specific_size, 0); +int ret; + +if (type_specific_size > INT32_MAX) { +av_log(s, AV_LOG_DEBUG, "Unsupported WAV header size (> INT32_MAX)\n"); +return AVERROR(ENOTSUP); +} + +ret = ff_get_wav_header(s, pb, st->codecpar, (int)type_specific_size, 0); if (ret < 0) return ret; if (is_dvr_ms_audio) { @@ -434,21 +441,32 @@ static int asf_read_stream_properties(AVFormatContext *s, uint64_t size) } } else if (type == AVMEDIA_TYPE_VIDEO && size - (avio_tell(pb) - pos1 + 24) >= 51) { +unsigned int width, height; avio_rl32(pb); avio_rl32(pb); avio_r8(pb); avio_rl16(pb);/* size */ -sizeX = avio_rl32(pb); /* size */ -st->codecpar->width = avio_rl32(pb); -st->codecpar->height = avio_rl32(pb); +sizeX = avio_rl32(pb); /* size */ +width = avio_rl32(pb); +height = avio_rl32(pb); + +if (width > INT32_MAX || height > INT32_MAX) { +av_log(s, AV_LOG_DEBUG, "Unsupported video size %dx%d\n", width, height); +return AVERROR(ENOTSUP); +} + +st->codecpar->width = (int)width; +st->codecpar->height = (int)height; /* not available for asf */ avio_rl16(pb); /* panes */ st->codecpar->bits_per_coded_sample = avio_rl16(pb); /* depth */ tag1 = avio_rl32(pb); avio_skip(pb, 20); if (sizeX > 40) { -if (size < sizeX - 40 || sizeX - 40 > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) -return AVERROR_INVALIDDATA; +if (size < sizeX - 40 || sizeX - 40 > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { +av_log(s, AV_LOG_DEBUG, "Unsupported extradata size\n"); +return AVERROR(ENOTSUP); +} st->codecpar->extradata_size = ffio_limit(pb, sizeX - 40); st->codecpar->extradata = av_mallocz(st->codecpar->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); @@ -500,9 +518,9 @@ static int asf_read_ext_stream_properties(AVFormatContext *s) ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; ff_asf_guid g; -int ext_len, payload_ext_ct, stream_ct, i; -uint32_t leak_rate, stream_num; -unsigned int stream_languageid_index; +uint16_t payload_ext_ct, stream_ct, i; +uint32_t leak_rate, ext_len; +uint16_t stream_languageid_index, stream_num; avio_rl64(pb); // starttime avio_rl64(pb); // endtime @@ -514,15 +532,15 @@ static int asf_read_ext_stream_properties(AVFormatContext *s) avio_rl32(pb); // alt-init-bucket-fullness avio_rl32(pb); // max-object-size avio_rl32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) -stream_num = avio_rl16(pb); // stream-num +stream_num = (uint16_t)avio_rl16(pb); // stream-num -stream_languageid_index = avio_rl16(pb); // stream-language-id-index +stream_languageid_index = (uint16_t)avio_rl16(pb); // stream-language-id-index if (stream_num < 128) asf->streams[stream_num].stream_language_index = stream_languageid_index; avio_rl64(pb); // avg frametime in 100ns units -stream_ct = avio_rl16(pb); // stream-name-count -payload_ext_ct = avio_rl16(pb); // payload-extension-system-count +stream_ct = (uint16_t)avio_rl16(pb); // stream-name-count +payload_ext_ct = (uint16_t)avio_rl16(pb); // payload-extension-system-count if (stream_num < 128) { asf->stream_bitrates[stream_num] = leak_rate; @@ -536,12 +554,10 @@ static int asf_read_ext_stream_properties(AVFormatContext *s) } for (i = 0; i < payload_ext_ct; i++) { -int size; +uint16_t size; ff_get_guid(pb, &g); -size = avio_
[FFmpeg-devel] [PATCH v4 06/10] libavformat/asfdec: fix macro definition and use
From: softworkz Signed-off-by: softworkz --- libavformat/asfdec_f.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 81a29f99d5..91c3874ac7 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -906,21 +906,21 @@ static int asf_read_header(AVFormatContext *s) } #define DO_2BITS(bits, var, defval) \ -switch (bits & 3) { \ +switch ((bits) & 3) { \ case 3: \ -var = avio_rl32(pb);\ +(var) = avio_rl32(pb); \ rsize += 4; \ break; \ case 2: \ -var = avio_rl16(pb);\ +(var) = avio_rl16(pb); \ rsize += 2; \ break; \ case 1: \ -var = avio_r8(pb); \ +(var) = avio_r8(pb);\ rsize++;\ break; \ default:\ -var = defval; \ +(var) = (defval); \ break; \ } @@ -1003,9 +1003,9 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb) asf->packet_flags= c; asf->packet_property = d; -DO_2BITS(asf->packet_flags >> 5, packet_length, s->packet_size); -DO_2BITS(asf->packet_flags >> 1, padsize, 0); // sequence ignored -DO_2BITS(asf->packet_flags >> 3, padsize, 0); // padding length +DO_2BITS(asf->packet_flags >> 5, packet_length, s->packet_size) +DO_2BITS(asf->packet_flags >> 1, padsize, 0) // sequence ignored +DO_2BITS(asf->packet_flags >> 3, padsize, 0) // padding length // the following checks prevent overflows and infinite loops if (!packet_length || packet_length >= (1U << 29)) { @@ -1066,9 +1066,9 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb) asf->stream_index = asf->asfid2avid[num & 0x7f]; asfst = &asf->streams[num & 0x7f]; // sequence should be ignored! -DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); -DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); -DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); +DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0) +DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0) +DO_2BITS(asf->packet_property, asf->packet_replic_size, 0) av_log(asf, AV_LOG_TRACE, "key:%d stream:%d seq:%d offset:%d replic_size:%d num:%X packet_property %X\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, asf->packet_frag_offset, asf->packet_replic_size, num, asf->packet_property); @@ -1144,7 +1144,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb) return AVERROR_INVALIDDATA; } if (asf->packet_flags & 0x01) { -DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal +DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0) // 0 is illegal if (rsize > asf->packet_size_left) { av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); return AVERROR_INVALIDDATA; -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 07/10] libavformat/asfdec: remove variable redefinition in inner scope
From: softworkz Signed-off-by: softworkz --- libavformat/asfdec_f.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 91c3874ac7..fae15d9b05 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -1191,7 +1191,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) return AVERROR_EOF; if (asf->packet_size_left < FRAME_HEADER_SIZE || asf->packet_segments < 1 && asf->packet_time_start == 0) { -int ret = asf->packet_size_left + asf->packet_padsize; +ret = asf->packet_size_left + asf->packet_padsize; if (asf->packet_size_left && asf->packet_size_left < FRAME_HEADER_SIZE) av_log(s, AV_LOG_WARNING, "Skip due to FRAME_HEADER_SIZE\n"); @@ -1260,7 +1260,6 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) if (asf_st->pkt.size != asf_st->packet_obj_size || // FIXME is this condition sufficient? asf_st->frag_offset + asf->packet_frag_size > asf_st->pkt.size) { -int ret; if (asf_st->pkt.data) { av_log(s, AV_LOG_INFO, -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 08/10] libavformat/asfdec: ensure variables are initialized
From: softworkz Signed-off-by: softworkz --- libavformat/asfdec_f.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index fae15d9b05..cb396cccfe 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -978,6 +978,7 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb) avio_seek(pb, -1, SEEK_CUR); // FIXME } } else { +d = e = 0; c = avio_r8(pb); if (c & 0x80) { rsize ++; -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 09/10] libavformat/asfdec: fix parameter type in asf_read_stream_propertie()
From: softworkz Signed-off-by: softworkz --- 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 cb396cccfe..95cab8b960 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -324,7 +324,7 @@ static int asf_read_file_properties(AVFormatContext *s) return 0; } -static int asf_read_stream_properties(AVFormatContext *s, int64_t size) +static int asf_read_stream_properties(AVFormatContext *s, uint64_t size) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".