[FFmpeg-cvslog] avformat/ttaenc: Defer freeing dynamic buffer

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Wed May 20 21:52:09 2020 +0200| [dbacecd347599aa421be94ad5e16521aa51f7014] | 
committer: Andreas Rheinhardt

avformat/ttaenc: Defer freeing dynamic buffer

The TTA muxer writes a seektable in a dynamic buffer as it receives
packets and when writing the trailer, closes the dynamic buffer using
avio_close_dyn_buf(), writes the seektable and frees the buffer. But
the TTA muxer already has a deinit function which unconditionally
calls ffio_free_dyn_buf() on the dynamic buffer, so switching to
avio_get_dyn_buf() means that one can remove the code to free the
buffer; furthermore, it also might save an allocation if the seektable
is so small that it fits into the dynamic buffer's write buffer or if
adding the padding that avio_close_dyn_buf() adds necessitated
reallocating of the underlying buffer.

Reviewed-by: James Almer 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dbacecd347599aa421be94ad5e16521aa51f7014
---

 libavformat/ttaenc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
index 4860aab4c1..becd3e7153 100644
--- a/libavformat/ttaenc.c
+++ b/libavformat/ttaenc.c
@@ -145,10 +145,8 @@ static int tta_write_trailer(AVFormatContext *s)
 /* Write Seek table */
 crc = ffio_get_checksum(tta->seek_table) ^ UINT32_MAX;
 avio_wl32(tta->seek_table, crc);
-size = avio_close_dyn_buf(tta->seek_table, );
+size = avio_get_dyn_buf(tta->seek_table, );
 avio_write(s->pb, ptr, size);
-tta->seek_table = NULL;
-av_free(ptr);
 
 /* Write audio data */
 tta_queue_flush(s);

___
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: Remove redundant resetting of pointer

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Tue May 19 12:35:59 2020 +0200| [9f6b738896196ffb911f75719d00b63ebc7ea217] | 
committer: Andreas Rheinhardt

avformat/hls: Remove redundant resetting of pointer

ff_id3v2_free_extra_meta() takes a ID3V2ExtraMeta ** so that it can
already reset the pointer.

Reviewed-by: Jun Zhao 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f6b738896196ffb911f75719d00b63ebc7ea217
---

 libavformat/hls.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index fc45719d1c..cd6c91214d 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1969,7 +1969,6 @@ static int hls_read_header(AVFormatContext *s)
 avformat_queue_attached_pictures(pls->ctx);
 ff_id3v2_parse_priv(pls->ctx, >id3_deferred_extra);
 ff_id3v2_free_extra_meta(>id3_deferred_extra);
-pls->id3_deferred_extra = NULL;
 }
 
 if (pls->is_id3_timestamped == -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] checkasm/sw_scale: Fix stack-buffer-overflow

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Tue May 19 08:30:05 2020 +0200| [57e570b508d967785b758e54c505db76c1597927] | 
committer: Andreas Rheinhardt

checkasm/sw_scale: Fix stack-buffer-overflow

A buffer whose size is not a multiple of four has been initialized using
consecutive writes of 32bits. This results in a stack-buffer-overflow
reported by ASAN in the checkasm-sw_scale FATE-test.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57e570b508d967785b758e54c505db76c1597927
---

 tests/checkasm/sw_scale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c
index 2680e47897..9efa2b4def 100644
--- a/tests/checkasm/sw_scale.c
+++ b/tests/checkasm/sw_scale.c
@@ -53,7 +53,7 @@ static void check_hscale(void)
 struct SwsContext *ctx;
 
 // padded
-LOCAL_ALIGNED_32(uint8_t, src, [SRC_PIXELS + MAX_FILTER_WIDTH - 1]);
+LOCAL_ALIGNED_32(uint8_t, src, [FFALIGN(SRC_PIXELS + MAX_FILTER_WIDTH - 1, 
4)]);
 LOCAL_ALIGNED_32(uint32_t, dst0, [SRC_PIXELS]);
 LOCAL_ALIGNED_32(uint32_t, dst1, [SRC_PIXELS]);
 

___
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] cbs_h265: Ensure that a predicted RPS doesn't contain too many pictures

2020-05-20 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun May  3 16:30:00 
2020 +0100| [c53f9f436440be4e180aa3895920ef21019c076f] | committer: Mark 
Thompson

cbs_h265: Ensure that a predicted RPS doesn't contain too many pictures

If the RPS we are predicting from has maximum size then at least one of
the pictures in it must be discarded before adding the current one.

Also revert 588114cea4ee434c9c61353ed91ffc817d2965f5, which added
now-redundant checks for the special case of a too-large RPS with all
pictures being in the same direction from the current one.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c53f9f436440be4e180aa3895920ef21019c076f
---

 libavcodec/cbs_h265_syntax_template.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index d3ac618db6..55da1a0a11 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -522,7 +522,7 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, 
RWContext *rw,
 infer(inter_ref_pic_set_prediction_flag, 0);
 
 if (current->inter_ref_pic_set_prediction_flag) {
-unsigned int ref_rps_idx, num_delta_pocs;
+unsigned int ref_rps_idx, num_delta_pocs, num_ref_pics;
 const H265RawSTRefPicSet *ref;
 int delta_rps, d_poc;
 int ref_delta_poc_s0[HEVC_MAX_REFS], ref_delta_poc_s1[HEVC_MAX_REFS];
@@ -538,18 +538,28 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext 
*ctx, RWContext *rw,
 ref_rps_idx = st_rps_idx - (current->delta_idx_minus1 + 1);
 ref = >st_ref_pic_set[ref_rps_idx];
 num_delta_pocs = ref->num_negative_pics + ref->num_positive_pics;
+av_assert0(num_delta_pocs < HEVC_MAX_DPB_SIZE);
 
 flag(delta_rps_sign);
 ue(abs_delta_rps_minus1, 0, INT16_MAX);
 delta_rps = (1 - 2 * current->delta_rps_sign) *
 (current->abs_delta_rps_minus1 + 1);
 
+num_ref_pics = 0;
 for (j = 0; j <= num_delta_pocs; j++) {
 flags(used_by_curr_pic_flag[j], 1, j);
 if (!current->used_by_curr_pic_flag[j])
 flags(use_delta_flag[j], 1, j);
 else
 infer(use_delta_flag[j], 1);
+if (current->use_delta_flag[i])
+++num_ref_pics;
+}
+if (num_ref_pics >= HEVC_MAX_DPB_SIZE) {
+av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid stream: "
+   "short-term ref pic set %d "
+   "contains too many pictures.\n", st_rps_idx);
+return AVERROR_INVALIDDATA;
 }
 
 // Since the stored form of an RPS here is actually the delta-step
@@ -601,8 +611,6 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, 
RWContext *rw,
 }
 }
 
-if (i > 15)
-return AVERROR_INVALIDDATA;
 infer(num_negative_pics, i);
 for (i = 0; i < current->num_negative_pics; i++) {
 infer(delta_poc_s0_minus1[i],
@@ -632,8 +640,6 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, 
RWContext *rw,
 }
 }
 
-if (i + current->num_negative_pics > 15)
-return AVERROR_INVALIDDATA;
 infer(num_positive_pics, i);
 for (i = 0; i < current->num_positive_pics; i++) {
 infer(delta_poc_s1_minus1[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] ffplay: set stream_index to -1 earlier to prevent segfault

2020-05-20 Thread Peter Ross
ffmpeg | branch: release/4.2 | Peter Ross  | Sat Apr 25 
11:25:15 2020 +1000| [1fc446d7e232f8b5e8d5c3d46b139e6249658f5f] | committer: 
Marton Balint

ffplay: set stream_index to -1 earlier to prevent segfault

Signed-off-by: Peter Ross 
Reviewed-by: Marton Balint 
(cherry picked from commit 6cfb33f976812a52bceba29b3db3bbdb84ab7c32)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1fc446d7e232f8b5e8d5c3d46b139e6249658f5f
---

 fftools/ffplay.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index fee0619f7c..a5d6852c18 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2760,9 +2760,6 @@ static int read_thread(void *arg)
 }
 
 memset(st_index, -1, sizeof(st_index));
-is->last_video_stream = is->video_stream = -1;
-is->last_audio_stream = is->audio_stream = -1;
-is->last_subtitle_stream = is->subtitle_stream = -1;
 is->eof = 0;
 
 ic = avformat_alloc_context();
@@ -3068,6 +3065,9 @@ static VideoState *stream_open(const char *filename, 
AVInputFormat *iformat)
 is = av_mallocz(sizeof(VideoState));
 if (!is)
 return NULL;
+is->last_video_stream = is->video_stream = -1;
+is->last_audio_stream = is->audio_stream = -1;
+is->last_subtitle_stream = is->subtitle_stream = -1;
 is->filename = av_strdup(filename);
 if (!is->filename)
 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] movenc: Use first H264/HEVC frame as extradata, if it is missing

2020-05-20 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Fri May  8 
14:21:32 2020 +0300| [9f891d0b4b584bc061808bfab35ffe9810d3bc77] | committer: 
Martin Storsjö

movenc: Use first H264/HEVC frame as extradata, if it is missing

Sticking a full frame in the extradata works, as the code for writing
the avcC/hvcC extracts the relevant parameter set NAL units - provided
that they actually exist in the frame.

Some encoders don't provide split out extradata directly on init (or
at all). In particular, the MediaFoundation encoder wrapper doesn't
always (depending on the actual encoder device) - this is the case for
Qualcomm's HEVC encoder on SD835, and also on some QSV H264 encoders).

This only works for cases where the moov hasn't already been written
(e.g. when not writing fragmented mp4 with empty_moov, unless using
the delay_moov option).

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f891d0b4b584bc061808bfab35ffe9810d3bc77
---

 libavformat/movenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 32e8109268..e6b3ea7ef1 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5583,6 +5583,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
 }
 
 if ((par->codec_id == AV_CODEC_ID_DNXHD ||
+ par->codec_id == AV_CODEC_ID_H264 ||
+ par->codec_id == AV_CODEC_ID_HEVC ||
  par->codec_id == AV_CODEC_ID_TRUEHD ||
  par->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len) {
 /* copy frame to create needed atoms */

___
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: Free temp buffer upon negative sample_size error.

2020-05-20 Thread Dale Curtis
ffmpeg | branch: release/4.2 | Dale Curtis  | Mon May 
18 15:35:35 2020 -0700| [7c01f2770131f3e80d1e365f334c26b908178ad4] | committer: 
Michael Niedermayer

avformat/mov: Free temp buffer upon negative sample_size error.

2d8d554f15a7a27cfeca81467cc9341a86f784e2 added a new error condition
to mov_read_stsz() but forgot to free a temporary buffer when it
occurs.

Signed-off-by: Dale Curtis 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit cd0771c38c06ef397466123c6c85521835f98bfd)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c01f2770131f3e80d1e365f334c26b908178ad4
---

 libavformat/mov.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e57e7444a6..6b0e101af9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2875,6 +2875,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 for (i = 0; i < entries && !pb->eof_reached; i++) {
 sc->sample_sizes[i] = get_bits_long(, field_size);
 if (sc->sample_sizes[i] < 0) {
+av_free(buf);
 av_log(c->fc, AV_LOG_ERROR, "Invalid sample size %d\n", 
sc->sample_sizes[i]);
 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] Update for 4.2.3

2020-05-20 Thread Michael Niedermayer
ffmpeg | branch: release/4.2 | Michael Niedermayer  | 
Wed May 20 19:44:32 2020 +0200| [137ceea9971259add813e1a9bedfa1cbc4fa22c4] | 
committer: Michael Niedermayer

Update for 4.2.3

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=137ceea9971259add813e1a9bedfa1cbc4fa22c4
---

 Changelog| 191 +++
 RELEASE  |   2 +-
 doc/Doxyfile |   2 +-
 3 files changed, 193 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 9c992b5c3e..7b4366323f 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,197 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version 4.2.3
+- avformat/mov: Free temp buffer upon negative sample_size error.
+- avformat/matroskadec: Improve forward compability
+- avformat/matroskadec: Don't discard valid packets
+- avformat/matroskaenc: Don't segfault when seekability changes
+- avformat/utils: Fix memleaks
+- avformat/utils: Fix memleaks in avformat_open_input()
+- avfilter/vf_dedot: Fix leak of AVFrame if making it writable fails
+- avfilter/vf_paletteuse: Fix potential double-free of AVFrame
+- avformat/mov: Don't leak MOVFragmentStreamInfo on error
+- avformat/mov: Free encryption data on error
+- fftools/ffmpeg: Free swresample dictionary during cleanup
+- avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak
+- avformat/webm_chunk: Close IO if writing header fails
+- avcodec/cavsdsp: Fix undefined left shifts of negative numbers
+- avcodec/ra144enc: Fix invalid left shift of negative number
+- avcodec/adxenc: Avoid undefined left shift of negative numbers
+- avcodec/adpcm: Fix undefined left shifts of negative numbers
+- avcodec/proresenc_anatoliy: Fix invalid left shift of negative number
+- avformat/aviobuf: Honor avio_open[2] documentation
+- avcodec/cinepakenc: Fix invalid shifts
+- avfilter/vf_xbr: Fix left shift of negative number
+- avfilter/vf_hqx: Fix undefined left shifts of negative numbers
+- avcodec/jpeg2000dwt: Fix undefined shifts of negative numbers
+- avcodec/ituh263dec: Fix undefined left shift of negative number
+- avcodec/dnxhdenc: Fix undefined left shifts of negative numbers
+- swscale/utils: Fix invalid left shifts of negative numbers
+- swscale/x86/swscale: Fix undefined left shifts of negative numbers
+- fftools/ffmpeg_opt: Fix signed integer overflow
+- avcodec/exr: Fix undefined left shifts of negative numbers
+- avformat/movenc: Fix undefined shift
+- avcodec/pcm: Fix undefined shifts
+- avcodec/wavpackenc: Fix undefined shifts
+- avutil/encryption_info: Don't pass NULL to memcpy
+- avcodec/ac3enc: Fix memleak
+- avcodec/ac3enc: Fix invalid shift
+- avcodec/g723_1dec: Fix invalid shift
+- avcodec/tdsc: Fix undefined shifts
+- avcodec/ttaenc: Fix undefined shift
+- avformat/avidec: Fix memleak with embedded GAB2 subtitles
+- avformat/matroskadec: Don't discard the upper 32bits of TrackNumber
+- dump_extradata: Insert extradata even for small packets
+- avformat/segafilmenc: Fix undefined left shift of 1 by 31 places
+- avformat/wtvdec: Fix memleak when reading header fails
+- avformat/dashenc: Fix leak of AVFormatContext on error
+- avformat/fitsdec: Fix potential leak of string in AVBPrint
+- avformat/matroskadec: Sanitize SeekHead entries
+- avformat/matroskaenc: Fix memleak upon encountering bogus chapter
+- avformat/matroskaenc: Make ebml_num_size() more robust
+- avformat/oggenc: Don't free AVStream's priv_data, fix memleak
+- avformat/utils: Fix memleak when decoding subtitle in find_stream_info
+- fftools/ffmpeg_opt: Check attachment filesize
+- avformat/mpeg: Don't use unintialized value
+- avformat/webmdashenc: Check codec types
+- avformat/webmdashenc: Fix memleak upon realloc failure
+- avformat/subtitles: Don't increment packet counter prematurely
+- avformat/bethsoftvid: Fix potential memleak upon reallocation failure
+- avformat/smoothstreaming: Fix memleaks on errors
+- avformat/matroskaenc: Check BlockAdditional size before use
+- avformat/matroskaenc: Check functions that can fail
+- avformat/matroskaenc: Check for reformatting errors
+- avformat/matroskadec: Check before allocations
+- avfilter/vf_unsharp: Don't dereference NULL
+- avcodec/zmbvenc: Correct offset in buffer
+- avcodec/cbs_h2645: Fix potential out-of-bounds array access
+- avformat/mov: Don't allow negative sample sizes.
+- mpeg4videoenc: Don't crash with -fsanitize=bounds
+- avformat/mpegts: Shuffle avio_seek
+- avcodec/binkaudio: Fix 2Ghz sample_rate
+- avcodec/adpcm: Fix integer overflow in ADPCM THP
+- avcodec/ralf: Check num_blocks before use
+- avcodec/iff: Test video_size being non zero
+- avcodec/utvideodec: Fix integer overflow in decode_plane()
+- avcodec/ttadsp: Fix several integer overflows in tta_filter_process_c()
+- avcodec/ralf: Fix integer overflow in decode_block()
+- avcodec/nuv: widen buf_size type
+- avcodec/iff: Fix several 

[FFmpeg-cvslog] avcodec/exr: output float pixels in float pixel format

2020-05-20 Thread Mark Reid
ffmpeg | branch: master | Mark Reid  | Sat May  9 18:48:58 
2020 -0700| [af5922a79a13e7ab48679c619bfcbf3a8491de1e] | committer: Michael 
Niedermayer

avcodec/exr: output float pixels in float pixel format

changes since v1
- default behavior, no longer hidden behind decoder parameter
- updated tests to reflect change

Reviewed-by: Paul B Mahol 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af5922a79a13e7ab48679c619bfcbf3a8491de1e
---

 libavcodec/exr.c   | 244 +++--
 tests/fate/image.mak   | 120 +-
 tests/ref/fate/exr-rgb-b44a-half-negative-4x4  |   2 +-
 .../fate/exr-rgb-scanline-b44-half-float-12x8-l1   |   2 +-
 .../fate/exr-rgb-scanline-b44-half-float-12x8-l2   |   2 +-
 tests/ref/fate/exr-rgb-scanline-float-b44  |   2 +-
 tests/ref/fate/exr-rgb-scanline-float-piz-48x32|   2 +-
 tests/ref/fate/exr-rgb-scanline-half-b44-12x8  |   2 +-
 tests/ref/fate/exr-rgb-scanline-half-b44-13x9  |   2 +-
 tests/ref/fate/exr-rgb-scanline-half-piz-bw|   2 +-
 tests/ref/fate/exr-rgb-scanline-half-piz-color |   2 +-
 tests/ref/fate/exr-rgb-scanline-half-piz-dw-t01|   2 +-
 tests/ref/fate/exr-rgb-scanline-half-piz-dw-t08|   2 +-
 tests/ref/fate/exr-rgb-scanline-none-negative-red  |   2 +-
 tests/ref/fate/exr-rgb-scanline-pxr24-float-12x8   |   2 +-
 .../ref/fate/exr-rgb-scanline-pxr24-float-half-l1  |   2 +-
 .../ref/fate/exr-rgb-scanline-pxr24-float-half-l2  |   2 +-
 .../ref/fate/exr-rgb-scanline-pxr24-half-float-l1  |   2 +-
 .../ref/fate/exr-rgb-scanline-pxr24-half-float-l2  |   2 +-
 .../fate/exr-rgb-scanline-pxr24-half-uint32-13x9   |   2 +-
 tests/ref/fate/exr-rgb-scanline-raw-half-float-l1  |   2 +-
 tests/ref/fate/exr-rgb-scanline-raw-half-float-l2  |   2 +-
 tests/ref/fate/exr-rgb-scanline-rle-half-float-l1  |   2 +-
 tests/ref/fate/exr-rgb-scanline-rle-half-float-l2  |   2 +-
 tests/ref/fate/exr-rgb-scanline-zip-half-float-l1  |   2 +-
 tests/ref/fate/exr-rgb-scanline-zip-half-float-l2  |   2 +-
 tests/ref/fate/exr-rgb-scanline-zip1-half-float-l1 |   2 +-
 ...xr-rgb-scanline-zip1-half-float-l1-zero-offsets |   2 +-
 tests/ref/fate/exr-rgb-scanline-zip1-half-float-l2 |   2 +-
 tests/ref/fate/exr-rgb-tile-float-raw-12x8 |   2 +-
 tests/ref/fate/exr-rgb-tile-float-raw-150x130  |   2 +-
 tests/ref/fate/exr-rgb-tile-half-float-b44-12x8-l1 |   2 +-
 tests/ref/fate/exr-rgb-tile-half-float-b44-12x8-l2 |   2 +-
 tests/ref/fate/exr-rgb-tile-half-raw-12x8  |   2 +-
 tests/ref/fate/exr-rgb-tile-pxr24-float-half-l1|   2 +-
 tests/ref/fate/exr-rgb-tile-pxr24-float-half-l2|   2 +-
 tests/ref/fate/exr-rgb-tile-pxr24-half-float-l1|   2 +-
 tests/ref/fate/exr-rgb-tile-pxr24-half-float-l2|   2 +-
 tests/ref/fate/exr-rgb-tile-raw-half-float-l1  |   2 +-
 tests/ref/fate/exr-rgb-tile-raw-half-float-l2  |   2 +-
 tests/ref/fate/exr-rgb-tile-rle-half-float-l1  |   2 +-
 tests/ref/fate/exr-rgb-tile-rle-half-float-l2  |   2 +-
 tests/ref/fate/exr-rgb-tile-zip-half-float-l1  |   2 +-
 tests/ref/fate/exr-rgb-tile-zip-half-float-l2  |   2 +-
 tests/ref/fate/exr-rgb-tile-zip1-half-float-l1 |   2 +-
 tests/ref/fate/exr-rgb-tile-zip1-half-float-l2 |   2 +-
 tests/ref/fate/exr-rgba-multiscanline-half-b44 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-12x8-l1  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-12x8-l2  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-13x9-l1  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44-13x9-l2  |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-12x8-l1 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-12x8-l2 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-13x9-l1 |   2 +-
 .../fate/exr-rgba-scanline-float-half-b44a-13x9-l2 |   2 +-
 tests/ref/fate/exr-rgba-zip16-16x32-flag4  |   2 +-
 tests/ref/fate/exr-slice-pxr24 |   2 +-
 tests/ref/fate/exr-slice-raw   |   2 +-
 tests/ref/fate/exr-slice-rle   |   2 +-
 tests/ref/fate/exr-slice-zip1  |   2 +-
 tests/ref/fate/exr-slice-zip16 |   2 +-
 tests/ref/fate/exr-y-scanline-zip-half-12x8|   2 +-
 tests/ref/fate/exr-y-tile-zip-half-12x8|   2 +-
 63 files changed, 246 insertions(+), 240 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 73419eadb1..68d5befa40 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -30,7 +30,6 @@
  * For more information on the OpenEXR format, visit:
  *  http://openexr.com/
  *
- * exr_flt2uint() and exr_halflt2uint() is credited to Reimar Döffinger.
  * exr_half2float() is credited to Aaftab Munshi, Dan Ginsburg, Dave Shreiner.
  */
 
@@ -160,7 +159,7 @@ typedef struct EXRContext {
 
 enum AVColorTransferCharacteristic apply_trc_type;
 float gamma;
-uint16_t gamma_table[65536];
+union av_intfloat32 

[FFmpeg-cvslog] fate: add adpcm_ima_cunning tests

2020-05-20 Thread Zane van Iperen
ffmpeg | branch: master | Zane van Iperen  | Sat May  9 
14:00:04 2020 +| [5a5d6e052adc8707d24cc26e66c6bb9d9293b27c] | committer: 
Michael Niedermayer

fate: add adpcm_ima_cunning tests

single:   Single-track
track{0,1}:   Dual-track
trunc-t1: Truncated track 1
trunc-t2-track{0,1}:  Fully-truncated track 2
trunc-t2a-track{0,1}: Partially-truncated track 2
trunc-h2: Truncated track 2 header

Signed-off-by: Zane van Iperen 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a5d6e052adc8707d24cc26e66c6bb9d9293b27c
---

 tests/fate/adpcm.mak  | 27 +++
 tests/ref/fate/adpcm-ima-cunning-single   |  1 +
 tests/ref/fate/adpcm-ima-cunning-track0   |  1 +
 tests/ref/fate/adpcm-ima-cunning-track1   |  1 +
 tests/ref/fate/adpcm-ima-cunning-trunc-h2 |  1 +
 tests/ref/fate/adpcm-ima-cunning-trunc-t1 |  1 +
 tests/ref/fate/adpcm-ima-cunning-trunc-t2-track0  |  1 +
 tests/ref/fate/adpcm-ima-cunning-trunc-t2-track1  |  1 +
 tests/ref/fate/adpcm-ima-cunning-trunc-t2a-track0 |  1 +
 tests/ref/fate/adpcm-ima-cunning-trunc-t2a-track1 |  1 +
 10 files changed, 36 insertions(+)

diff --git a/tests/fate/adpcm.mak b/tests/fate/adpcm.mak
index 3e6d4ecdd1..bc2804477f 100644
--- a/tests/fate/adpcm.mak
+++ b/tests/fate/adpcm.mak
@@ -112,5 +112,32 @@ fate-adpcm-ima-alp-mono: CMD = md5 -i 
$(TARGET_SAMPLES)/alp/AD_P11.PCM -f s16le
 FATE_ADPCM-$(call DEMDEC, ALP, ADPCM_IMA_ALP) += fate-adpcm-ima-alp-stereo
 fate-adpcm-ima-alp-stereo: CMD = md5 -i $(TARGET_SAMPLES)/alp/theme-cut.tun -f 
s16le
 
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-single
+fate-adpcm-ima-cunning-single: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/GD-cut.5c -f s16le
+
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-track0
+fate-adpcm-ima-cunning-track0: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/VIDEOMOD-cut.11c -map 0:a:0 -f s16le
+
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-track1
+fate-adpcm-ima-cunning-track1: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/VIDEOMOD-cut.11c -map 0:a:1 -f s16le
+
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-trunc-t1
+fate-adpcm-ima-cunning-trunc-t1: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/VIDEOMOD-trunc-t1.11c -map 0:a:0 -f s16le
+
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-trunc-t2-track0
+fate-adpcm-ima-cunning-trunc-t2-track0: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/VIDEOMOD-trunc-t2.11c -map 0:a:0 -f s16le
+
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-trunc-t2-track1
+fate-adpcm-ima-cunning-trunc-t2-track1: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/VIDEOMOD-trunc-t2.11c -map 0:a:1 -f s16le
+
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-trunc-t2a-track0
+fate-adpcm-ima-cunning-trunc-t2a-track0: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/VIDEOMOD-trunc-t2a.11c -map 0:a:0 -f s16le
+
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-trunc-t2a-track1
+fate-adpcm-ima-cunning-trunc-t2a-track1: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/VIDEOMOD-trunc-t2a.11c -map 0:a:1 -f s16le
+
+FATE_ADPCM-$(call DEMDEC, PP_BNK, ADPCM_IMA_CUNNING) += 
fate-adpcm-ima-cunning-trunc-h2
+fate-adpcm-ima-cunning-trunc-h2: CMD = md5 -y -i 
$(TARGET_SAMPLES)/pp_bnk/VIDEOMOD-trunc-h2.11c -map 0:a:0 -f s16le
+
 FATE_SAMPLES_AVCONV += $(FATE_ADPCM-yes)
 fate-adpcm: $(FATE_ADPCM-yes)
diff --git a/tests/ref/fate/adpcm-ima-cunning-single 
b/tests/ref/fate/adpcm-ima-cunning-single
new file mode 100644
index 00..49a8308093
--- /dev/null
+++ b/tests/ref/fate/adpcm-ima-cunning-single
@@ -0,0 +1 @@
+dd6ba6151c3e74d09be3c54005465aab
diff --git a/tests/ref/fate/adpcm-ima-cunning-track0 
b/tests/ref/fate/adpcm-ima-cunning-track0
new file mode 100644
index 00..bd489cfb45
--- /dev/null
+++ b/tests/ref/fate/adpcm-ima-cunning-track0
@@ -0,0 +1 @@
+fb8db1eef33860c1adde4932e7a250ac
diff --git a/tests/ref/fate/adpcm-ima-cunning-track1 
b/tests/ref/fate/adpcm-ima-cunning-track1
new file mode 100644
index 00..f79013c9de
--- /dev/null
+++ b/tests/ref/fate/adpcm-ima-cunning-track1
@@ -0,0 +1 @@
+4b2f9c416ae676526754c82f2a669c91
diff --git a/tests/ref/fate/adpcm-ima-cunning-trunc-h2 
b/tests/ref/fate/adpcm-ima-cunning-trunc-h2
new file mode 100644
index 00..bd489cfb45
--- /dev/null
+++ b/tests/ref/fate/adpcm-ima-cunning-trunc-h2
@@ -0,0 +1 @@
+fb8db1eef33860c1adde4932e7a250ac
diff --git a/tests/ref/fate/adpcm-ima-cunning-trunc-t1 
b/tests/ref/fate/adpcm-ima-cunning-trunc-t1
new file mode 100644
index 00..4669e38855
--- /dev/null
+++ b/tests/ref/fate/adpcm-ima-cunning-trunc-t1
@@ -0,0 +1 @@
+a0eaad31febdcf1cfb94a4d418e1e140
diff --git a/tests/ref/fate/adpcm-ima-cunning-trunc-t2-track0 

[FFmpeg-cvslog] avformat/mov: Free temp buffer upon negative sample_size error.

2020-05-20 Thread Dale Curtis
ffmpeg | branch: master | Dale Curtis  | Mon May 18 
15:35:35 2020 -0700| [cd0771c38c06ef397466123c6c85521835f98bfd] | committer: 
Michael Niedermayer

avformat/mov: Free temp buffer upon negative sample_size error.

2d8d554f15a7a27cfeca81467cc9341a86f784e2 added a new error condition
to mov_read_stsz() but forgot to free a temporary buffer when it
occurs.

Signed-off-by: Dale Curtis 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd0771c38c06ef397466123c6c85521835f98bfd
---

 libavformat/mov.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6490022b1d..e11c9f4457 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2886,6 +2886,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 for (i = 0; i < entries && !pb->eof_reached; i++) {
 sc->sample_sizes[i] = get_bits_long(, field_size);
 if (sc->sample_sizes[i] < 0) {
+av_free(buf);
 av_log(c->fc, AV_LOG_ERROR, "Invalid sample size %d\n", 
sc->sample_sizes[i]);
 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] avfilter/af_aiir: fix phase and group delay calculation

2020-05-20 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed May 20 11:01:56 
2020 +0200| [86822cfcd99e38c6a787ebc6141967df4ff80eb5] | committer: Paul B Mahol

avfilter/af_aiir: fix phase and group delay calculation

Properly unwrap phase.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86822cfcd99e38c6a787ebc6141967df4ff80eb5
---

 libavfilter/af_aiir.c | 60 +--
 1 file changed, 44 insertions(+), 16 deletions(-)

diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index c56ed0f3a0..187cbb6fd7 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -819,11 +819,11 @@ static void get_response(int channel, int format, double 
w,
 *i = imag;
 }
 
-static void draw_response(AVFilterContext *ctx, AVFrame *out)
+static void draw_response(AVFilterContext *ctx, AVFrame *out, int sample_rate)
 {
 AudioIIRContext *s = ctx->priv;
-float *mag, *phase, *delay, min = FLT_MAX, max = FLT_MIN;
-float min_delay = FLT_MAX, max_delay = FLT_MIN;
+double *mag, *phase, *temp, *delay, min = DBL_MAX, max = -DBL_MAX;
+double min_delay, max_delay, min_phase, max_phase;
 int prev_ymag = -1, prev_yphase = -1, prev_ydelay = -1;
 char text[32];
 int ch, i;
@@ -831,9 +831,10 @@ static void draw_response(AVFilterContext *ctx, AVFrame 
*out)
 memset(out->data[0], 0, s->h * out->linesize[0]);
 
 phase = av_malloc_array(s->w, sizeof(*phase));
+temp = av_malloc_array(s->w, sizeof(*temp));
 mag = av_malloc_array(s->w, sizeof(*mag));
 delay = av_malloc_array(s->w, sizeof(*delay));
-if (!mag || !phase || !delay)
+if (!mag || !phase || !delay || !temp)
 goto end;
 
 ch = av_clip(s->ir_channel, 0, s->channels - 1);
@@ -849,16 +850,34 @@ static void draw_response(AVFilterContext *ctx, AVFrame 
*out)
 
 mag[i] = s->iir[ch].g * hypot(real, imag);
 phase[i] = atan2(imag, real);
-min = fminf(min, mag[i]);
-max = fmaxf(max, mag[i]);
+min = fmin(min, mag[i]);
+max = fmax(max, mag[i]);
 }
 
+temp[0] = 0.;
 for (i = 0; i < s->w - 1; i++) {
-float dw =  M_PI / (s->w - 1);
+double d = phase[i] - phase[i + 1];
+temp[i + 1] = ceil(fabs(d) / (2. * M_PI)) * 2. * M_PI * ((d > M_PI) - 
(d < -M_PI));
+}
 
-delay[i] = -(phase[i + 1] - phase[i]) / dw;
-min_delay = fminf(min_delay, delay[i]);
-max_delay = fmaxf(max_delay, delay[i]);
+min_phase = phase[0];
+max_phase = phase[0];
+for (i = 1; i < s->w; i++) {
+temp[i] += temp[i - 1];
+phase[i] += temp[i];
+min_phase = fmin(min_phase, phase[i]);
+max_phase = fmax(max_phase, phase[i]);
+}
+
+delay[0] = 0.;
+min_delay = 0.;
+max_delay = 0.;
+for (i = 0; i < s->w - 1; i++) {
+double div = s->w / (double)sample_rate;
+
+delay[i + 1] = -(phase[i] - phase[i + 1]) / div;
+min_delay = fmin(min_delay, delay[i + 1]);
+max_delay = fmax(max_delay, delay[i + 1]);
 }
 
 delay[i] = delay[i - 1];
@@ -866,7 +885,7 @@ static void draw_response(AVFilterContext *ctx, AVFrame 
*out)
 for (i = 0; i < s->w; i++) {
 int ymag = mag[i] / max * (s->h - 1);
 int ydelay = (delay[i] - min_delay) / (max_delay - min_delay) * (s->h 
- 1);
-int yphase = (0.5 * (1. + phase[i] / M_PI)) * (s->h - 1);
+int yphase = (phase[i] - min_phase) / (max_phase - min_phase) * (s->h 
- 1);
 
 ymag = s->h - 1 - av_clip(ymag, 0, s->h - 1);
 yphase = s->h - 1 - av_clip(yphase, 0, s->h - 1);
@@ -897,17 +916,26 @@ static void draw_response(AVFilterContext *ctx, AVFrame 
*out)
 snprintf(text, sizeof(text), "%.2f", min);
 drawtext(out, 15 * 8 + 2, 12, text, 0x);
 
-drawtext(out, 2, 22, "Max Delay:", 0x);
+drawtext(out, 2, 22, "Max Phase:", 0x);
+snprintf(text, sizeof(text), "%.2f", max_phase);
+drawtext(out, 15 * 8 + 2, 22, text, 0x);
+
+drawtext(out, 2, 32, "Min Phase:", 0x);
+snprintf(text, sizeof(text), "%.2f", min_phase);
+drawtext(out, 15 * 8 + 2, 32, text, 0x);
+
+drawtext(out, 2, 42, "Max Delay:", 0x);
 snprintf(text, sizeof(text), "%.2f", max_delay);
-drawtext(out, 11 * 8 + 2, 22, text, 0x);
+drawtext(out, 11 * 8 + 2, 42, text, 0x);
 
-drawtext(out, 2, 32, "Min Delay:", 0x);
+drawtext(out, 2, 52, "Min Delay:", 0x);
 snprintf(text, sizeof(text), "%.2f", min_delay);
-drawtext(out, 11 * 8 + 2, 32, text, 0x);
+drawtext(out, 11 * 8 + 2, 52, text, 0x);
 }
 
 end:
 av_free(delay);
+av_free(temp);
 av_free(phase);
 av_free(mag);
 }
@@ -951,7 +979,7 @@ static int config_output(AVFilterLink *outlink)
 if (!s->video)
 return AVERROR(ENOMEM);
 
-draw_response(ctx, s->video);
+

[FFmpeg-cvslog] avformat/matroskadec: Improve forward compability

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Wed Mar 25 06:52:09 2020 +0100| 
[0a4e978f35dd78668cf525be61e3b26a354db769] | committer: Andreas Rheinhardt

avformat/matroskadec: Improve forward compability

Matroska is built around the principle that a reader does not need to
understand everything in a file in order to be able to make use of it;
it just needs to ignore the data it doesn't know about.

Our demuxer typically follows this principle, but there is one important
instance where it does not: A Block belonging to a TrackEntry with no
associated stream is treated as invalid data (i.e. the demuxer will try
to resync to the next level 1 element because it takes this as a sign
that it has lost sync). Given that we do not create streams if we don't
know or don't support the type of the TrackEntry, this impairs this
demuxer's forward compability.

Furthermore, ignoring Blocks belonging to a TrackEntry without
corresponding stream can (in future commits) also be used to ignore
TrackEntries with obviously bogus entries without affecting the other
TrackEntries (by not creating a stream for said TrackEntry).

Finally, given that matroska_find_track_by_num() already emits its own
error message in case there is no TrackEntry with a given TrackNumber,
the error message (with level AV_LOG_INFO) for this can be removed.

Signed-off-by: Andreas Rheinhardt 
(cherry picked from commit b577968cabae4a0927adcf5d7c24fca5a7a8385d)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a4e978f35dd78668cf525be61e3b26a354db769
---

 libavformat/matroskadec.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3cf4296f8d..938ba2cdb2 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3563,13 +3563,16 @@ static int matroska_parse_block(MatroskaDemuxContext 
*matroska, AVBufferRef *buf
 size -= n;
 
 track = matroska_find_track_by_num(matroska, num);
-if (!track || !track->stream) {
-av_log(matroska->ctx, AV_LOG_INFO,
-   "Invalid stream %"PRIu64"\n", num);
+if (!track || size < 3)
 return AVERROR_INVALIDDATA;
-} else if (size < 3)
-return AVERROR_INVALIDDATA;
-st = track->stream;
+
+if (!(st = track->stream)) {
+av_log(matroska->ctx, AV_LOG_VERBOSE,
+   "No stream associated to TrackNumber %"PRIu64". "
+   "Ignoring Block with this TrackNumber.\n", num);
+return 0;
+}
+
 if (st->discard >= AVDISCARD_ALL)
 return res;
 av_assert1(block_duration != AV_NOPTS_VALUE);

___
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: Don't discard valid packets

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Wed Mar 25 06:00:53 2020 +0100| 
[26d1e77923f35bcd959249dd5a351e30a93a65f0] | committer: Andreas Rheinhardt

avformat/matroskadec: Don't discard valid packets

A Block (meaning both a Block in a BlockGroup as well as a SimpleBlock)
must have at least three bytes after the field containing the encoded
TrackNumber. So if there are <= 3 bytes, the Matroska demuxer would
skip this block, believing it to be an empty, but valid Block.

This might discard valid nonempty Blocks, namely if the track uses header
stripping. And certain definitely spec-incompliant Blocks don't raise
errors: Those with two or less bytes left after the encoded TrackNumber
and those with three bytes left, but with flags indicating that the Block
uses lacing as then there has to be further data describing the lacing.

Furthermore, zero-sized packets were still possible because only the
size of the last entry of a lace was checked.

This commit fixes this. All spec-compliant Blocks that contain data
(even if side data only) are now returned to the caller; spec-compliant
Blocks that don't contain anything are not returned.

Signed-off-by: Andreas Rheinhardt 
(cherry picked from commit e471faf96230076f67e393df9d1a90a08c22a055)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=26d1e77923f35bcd959249dd5a351e30a93a65f0
---

 libavformat/matroskadec.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 36bd9c3848..3cf4296f8d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3023,7 +3023,9 @@ static int matroska_parse_laces(MatroskaDemuxContext 
*matroska, uint8_t **buf,
 return 0;
 }
 
-av_assert0(size > 0);
+if (size <= 0)
+return AVERROR_INVALIDDATA;
+
 *laces= *data + 1;
 data += 1;
 size -= 1;
@@ -3053,7 +3055,7 @@ static int matroska_parse_laces(MatroskaDemuxContext 
*matroska, uint8_t **buf,
 break;
 }
 }
-if (size <= total) {
+if (size < total) {
 res = AVERROR_INVALIDDATA;
 break;
 }
@@ -3100,7 +3102,7 @@ static int matroska_parse_laces(MatroskaDemuxContext 
*matroska, uint8_t **buf,
 lace_size[n] = lace_size[n - 1] + snum;
 total   += lace_size[n];
 }
-if (size <= total) {
+if (size < total) {
 res = AVERROR_INVALIDDATA;
 break;
 }
@@ -3422,7 +3424,7 @@ static int matroska_parse_frame(MatroskaDemuxContext 
*matroska,
 {
 MatroskaTrackEncoding *encodings = track->encodings.elem;
 uint8_t *pkt_data = data;
-int res;
+int res = 0;
 AVPacket pktl, *pkt = 
 
 if (encodings && !encodings->type && encodings->scope & 1) {
@@ -3458,6 +3460,9 @@ static int matroska_parse_frame(MatroskaDemuxContext 
*matroska,
 pkt_data = pr_data;
 }
 
+if (!pkt_size && !additional_size)
+goto no_output;
+
 av_init_packet(pkt);
 if (pkt_data != data)
 pkt->buf = av_buffer_create(pkt_data, pkt_size + 
AV_INPUT_BUFFER_PADDING_SIZE,
@@ -3528,6 +3533,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 return 0;
 
+no_output:
 fail:
 if (pkt_data != data)
 av_freep(_data);
@@ -3561,8 +3567,8 @@ static int matroska_parse_block(MatroskaDemuxContext 
*matroska, AVBufferRef *buf
 av_log(matroska->ctx, AV_LOG_INFO,
"Invalid stream %"PRIu64"\n", num);
 return AVERROR_INVALIDDATA;
-} else if (size <= 3)
-return 0;
+} else if (size < 3)
+return AVERROR_INVALIDDATA;
 st = track->stream;
 if (st->discard >= AVDISCARD_ALL)
 return res;

___
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/matroskaenc: Don't segfault when seekability changes

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Fri May  1 20:21:45 2020 +0200| 
[588d258ea430cea3e954da8e553746e6f1a4b5bc] | committer: Andreas Rheinhardt

avformat/matroskaenc: Don't segfault when seekability changes

If the Matroska muxer's AVIOContext was unseekable when writing the
header, but is seekable when writing the trailer, the code for writing
the trailer presumes that a dynamic buffer exists and tries to update
its content in order to overwrite data that has already been
preliminarily written when writing the header, yet said buffer doesn't
exist as it has been written finally and not preliminarily when writing
the header (because of the unseekability it was presumed that one won't
be able to update the data anyway).

This commit adds a check for this and also for a similar situation
involving updating extradata with new data from packet side-data.

Signed-off-by: Andreas Rheinhardt 
(cherry picked from commit 8aabcf6c1151b9e50ae5447da6709a72022b9a60)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=588d258ea430cea3e954da8e553746e6f1a4b5bc
---

 libavformat/matroskaenc.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index ce42ce7cc8..0f535f61d4 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2300,7 +2300,7 @@ static int mkv_check_new_extra_data(AVFormatContext *s, 
AVPacket *pkt)
 
 switch (par->codec_id) {
 case AV_CODEC_ID_AAC:
-if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && 
!mkv->is_live) {
+if (side_data_size && mkv->tracks_bc) {
 int filler, output_sample_rate = 0;
 int64_t curpos;
 ret = get_aac_sample_rates(s, side_data, side_data_size, 
>sample_rate,
@@ -2331,7 +2331,7 @@ static int mkv_check_new_extra_data(AVFormatContext *s, 
AVPacket *pkt)
 }
 break;
 case AV_CODEC_ID_FLAC:
-if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && 
!mkv->is_live) {
+if (side_data_size && mkv->tracks_bc) {
 AVCodecParameters *codecpriv_par;
 int64_t curpos;
 if (side_data_size != par->extradata_size) {
@@ -2358,8 +2358,7 @@ static int mkv_check_new_extra_data(AVFormatContext *s, 
AVPacket *pkt)
 // FIXME: Remove the following once libaom starts propagating extradata 
during init()
 //See https://bugs.chromium.org/p/aomedia/issues/detail?id=2012
 case AV_CODEC_ID_AV1:
-if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && 
!mkv->is_live &&
-!par->extradata_size) {
+if (side_data_size && mkv->tracks_bc && !par->extradata_size) {
 AVIOContext *dyn_cp;
 uint8_t *codecpriv;
 int codecpriv_size;
@@ -2639,14 +2638,18 @@ static int mkv_write_trailer(AVFormatContext *s)
 // update the duration
 av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration);
 currentpos = avio_tell(pb);
+if (mkv->info_bc) {
 avio_seek(mkv->info_bc, mkv->duration_offset, SEEK_SET);
 put_ebml_float(mkv->info_bc, MATROSKA_ID_DURATION, mkv->duration);
 avio_seek(pb, mkv->info_pos, SEEK_SET);
 end_ebml_master_crc32(pb, >info_bc, mkv, MATROSKA_ID_INFO);
+}
 
+if (mkv->tracks_bc) {
 // write tracks master
 avio_seek(pb, mkv->tracks_pos, SEEK_SET);
 end_ebml_master_crc32(pb, >tracks_bc, mkv, MATROSKA_ID_TRACKS);
+}
 
 // update stream durations
 if (!mkv->is_live && mkv->stream_durations) {

___
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/utils: Fix memleaks in avformat_open_input()

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Tue Jan  7 14:55:47 2020 +0100| 
[2c884238571efe97e1add6e42efc9e6f6cb8f706] | committer: Andreas Rheinhardt

avformat/utils: Fix memleaks in avformat_open_input()

A demuxer might have allocated memory while reading the header. If
reading the header was successfull and an error happens before returning
(e.g. when queueing the attached pictures), the read_close function
would have never been called, so that all those allocations would leak.
This commit changes this.

Furthermore, there would be even more memleaks if the error level was
set to AV_EF_EXPLODE in case there is both metadata and id3v2 metadata.
This has been fixed, too.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Marton Balint 
(cherry picked from commit e2307f4ff197646a7feee0edbcdd2d3262932676)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c884238571efe97e1add6e42efc9e6f6cb8f706
---

 libavformat/utils.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index f32ced0116..c2a5e5f581 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -640,26 +640,28 @@ FF_ENABLE_DEPRECATION_WARNINGS
 level = AV_LOG_ERROR;
 av_log(s, level, "Discarding ID3 tags because more suitable tags were 
found.\n");
 av_dict_free(>internal->id3v2_meta);
-if (s->error_recognition & AV_EF_EXPLODE)
-return AVERROR_INVALIDDATA;
+if (s->error_recognition & AV_EF_EXPLODE) {
+ret = AVERROR_INVALIDDATA;
+goto close;
+}
 }
 
 if (id3v2_extra_meta) {
 if (!strcmp(s->iformat->name, "mp3") || !strcmp(s->iformat->name, 
"aac") ||
 !strcmp(s->iformat->name, "tta") || !strcmp(s->iformat->name, 
"wav")) {
 if ((ret = ff_id3v2_parse_apic(s, _extra_meta)) < 0)
-goto fail;
+goto close;
 if ((ret = ff_id3v2_parse_chapters(s, _extra_meta)) < 0)
-goto fail;
+goto close;
 if ((ret = ff_id3v2_parse_priv(s, _extra_meta)) < 0)
-goto fail;
+goto close;
 } else
 av_log(s, AV_LOG_DEBUG, "demuxer does not support additional id3 
data, skipping\n");
 }
 ff_id3v2_free_extra_meta(_extra_meta);
 
 if ((ret = avformat_queue_attached_pictures(s)) < 0)
-goto fail;
+goto close;
 
 if (!(s->flags_FLAG_PRIV_OPT) && s->pb && !s->internal->data_offset)
 s->internal->data_offset = avio_tell(s->pb);
@@ -678,6 +680,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 *ps = s;
 return 0;
 
+close:
+if (s->iformat->read_close)
+s->iformat->read_close(s);
 fail:
 ff_id3v2_free_extra_meta(_extra_meta);
 av_dict_free();

___
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/utils: Fix memleaks

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Tue Sep 24 18:31:44 2019 +0200| 
[f2117e1e9c5c87e794d6dff872d48026cf24db2f] | committer: Andreas Rheinhardt

avformat/utils: Fix memleaks

ff_read_packet had potential memleaks:
1. If av_packet_make_refcounted fails, it means that the packet is not
refcounted, but it could nevertheless carry side data and therefore
needs to be unreferenced.
2. If putting a packet on a packet list fails, it wasn't unreferenced.

Furthermore, read_frame_internal leaked a packet's (side) data if a
context update was required and failed.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: James Almer 
(cherry picked from commit 66d5e43b9909804511a3e1fb65f6f0bbb0264eb3)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2117e1e9c5c87e794d6dff872d48026cf24db2f
---

 libavformat/utils.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index c2a5e5f581..73cdb3383c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -878,8 +878,10 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
 }
 
 err = av_packet_make_refcounted(pkt);
-if (err < 0)
+if (err < 0) {
+av_packet_unref(pkt);
 return err;
+}
 
 if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
 (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
@@ -922,8 +924,10 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
 err = ff_packet_list_put(>internal->raw_packet_buffer,
  >internal->raw_packet_buffer_end,
  pkt, 0);
-if (err)
+if (err < 0) {
+av_packet_unref(pkt);
 return err;
+}
 s->internal->raw_packet_buffer_remaining_size -= pkt->size;
 
 if ((err = probe_codec(s, st, pkt)) < 0)
@@ -1616,15 +1620,19 @@ static int read_frame_internal(AVFormatContext *s, 
AVPacket *pkt)
 }
 
 ret = avcodec_parameters_to_context(st->internal->avctx, 
st->codecpar);
-if (ret < 0)
+if (ret < 0) {
+av_packet_unref(_pkt);
 return ret;
+}
 
 #if FF_API_LAVF_AVCTX
 FF_DISABLE_DEPRECATION_WARNINGS
 /* update deprecated public codec context */
 ret = avcodec_parameters_to_context(st->codec, st->codecpar);
-if (ret < 0)
+if (ret < 0) {
+av_packet_unref(_pkt);
 return ret;
+}
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avfilter/vf_dedot: Fix leak of AVFrame if making it writable fails

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Sun Feb  9 19:40:34 2020 +0100| 
[15ccdea8b381e4e120fd5a98b98b6fde5371097f] | committer: Andreas Rheinhardt

avfilter/vf_dedot: Fix leak of AVFrame if making it writable fails

Even in this scenario, the frame still contains references to data that
won't be freed if the frame isn't unreferenced. And the AVFrame itself
will leak, too.

Fixes Coverity issue #1441422.

Signed-off-by: Andreas Rheinhardt 
Reviewed-by: Paul B Mahol 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 212077eda46c4c3eb644774d2b1ccbeb3e322fff)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=15ccdea8b381e4e120fd5a98b98b6fde5371097f
---

 libavfilter/vf_dedot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_dedot.c b/libavfilter/vf_dedot.c
index bb0f9e5ac8..ff2e0e3a79 100644
--- a/libavfilter/vf_dedot.c
+++ b/libavfilter/vf_dedot.c
@@ -312,7 +312,8 @@ static int activate(AVFilterContext *ctx)
FFMIN(s->planeheight[2],
ff_filter_get_nb_threads(ctx)));
 }
-}
+} else
+av_frame_free();
 } else if (!out) {
 ret = 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/mov: Free encryption data on error

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Mon Jan 27 09:28:18 2020 +0100| 
[09d2b9b7bedb1e95a5aa365794c02fb5dd183025] | committer: Andreas Rheinhardt

avformat/mov: Free encryption data on error

Fixes memleak and Coverity issue #1439587.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3999c4b374c2f3786137bd7e820dd1555fc20d90)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09d2b9b7bedb1e95a5aa365794c02fb5dd183025
---

 libavformat/mov.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2e726d3e90..0a9abaa795 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6310,8 +6310,10 @@ static int mov_read_pssh(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 if (version > 0) {
 kid_count = avio_rb32(pb);
-if (kid_count >= INT_MAX / sizeof(*key_ids))
-return AVERROR(ENOMEM);
+if (kid_count >= INT_MAX / sizeof(*key_ids)) {
+ret = AVERROR(ENOMEM);
+goto finish;
+}
 
 for (unsigned int i = 0; i < kid_count && !pb->eof_reached; i++) {
 unsigned int min_kid_count = FFMIN(FFMAX(i + 1, 1024), kid_count);

___
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_paletteuse: Fix potential double-free of AVFrame

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Mon Jan 27 09:28:20 2020 +0100| 
[126cd3821da47971405fd39d9efd162b16b28651] | committer: Andreas Rheinhardt

avfilter/vf_paletteuse: Fix potential double-free of AVFrame

apply_palette() would free an AVFrame given to it only via an AVFrame *
(and not via AVFrame **) in three of its four exists (namely in the
normal path and in two error paths). So upon error the caller has no way
to know whether the frame has already been freed or not;
load_apply_palette(), the only caller, opted to free the frame in this
scenario.

This commit changes this by making apply_palette not freeing the frame
at all, which is left to load_apply_palette().

Fixes Coverity issue #1452434.

Signed-off-by: Andreas Rheinhardt 
Reviewed-by: Paul B Mahol 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit adea33f46513821c111c602a0692b78315688c1b)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=126cd3821da47971405fd39d9efd162b16b28651
---

 libavfilter/vf_paletteuse.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index ed128813d6..255c9d79e3 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -903,7 +903,6 @@ static int apply_palette(AVFilterLink *inlink, AVFrame *in, 
AVFrame **outf)
 
 AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!out) {
-av_frame_free();
 *outf = NULL;
 return AVERROR(ENOMEM);
 }
@@ -916,7 +915,6 @@ static int apply_palette(AVFilterLink *inlink, AVFrame *in, 
AVFrame **outf)
 if (av_frame_ref(s->last_in, in) < 0 ||
 av_frame_ref(s->last_out, out) < 0 ||
 av_frame_make_writable(s->last_in) < 0) {
-av_frame_free();
 av_frame_free();
 *outf = NULL;
 return AVERROR(ENOMEM);
@@ -934,7 +932,6 @@ static int apply_palette(AVFilterLink *inlink, AVFrame *in, 
AVFrame **outf)
 memcpy(out->data[1], s->palette, AVPALETTE_SIZE);
 if (s->calc_mean_err)
 debug_mean_error(s, in, out, inlink->frame_count_out);
-av_frame_free();
 *outf = out;
 return 0;
 }
@@ -1023,20 +1020,17 @@ static int load_apply_palette(FFFrameSync *fs)
 if (ret < 0)
 return ret;
 if (!master || !second) {
-ret = AVERROR_BUG;
-goto error;
+av_frame_free();
+return AVERROR_BUG;
 }
 if (!s->palette_loaded) {
 load_palette(s, second);
 }
 ret = apply_palette(inlink, master, );
+av_frame_free();
 if (ret < 0)
-goto error;
+return ret;
 return ff_filter_frame(ctx->outputs[0], out);
-
-error:
-av_frame_free();
-return ret;
 }
 
 #define DEFINE_SET_FRAME(color_search, name, value)
 \

___
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: Don't leak MOVFragmentStreamInfo on error

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Mon Jan 27 09:28:19 2020 +0100| 
[fa7d8d63db11fa7eaaf60dc7f6573612f5f3ff98] | committer: Andreas Rheinhardt

avformat/mov: Don't leak MOVFragmentStreamInfo on error

Fixes Coverity issue #1441933.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 43f58f2354bfab3819e44c1a97b0af75cc091226)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa7d8d63db11fa7eaaf60dc7f6573612f5f3ff98
---

 libavformat/mov.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0a9abaa795..e57e7444a6 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1327,8 +1327,10 @@ static int update_frag_index(MOVContext *c, int64_t 
offset)
 
 for (i = 0; i < c->fc->nb_streams; i++) {
 // Avoid building frag index if streams lack track id.
-if (c->fc->streams[i]->id < 0)
+if (c->fc->streams[i]->id < 0) {
+av_free(frag_stream_info);
 return AVERROR_INVALIDDATA;
+}
 
 frag_stream_info[i].id = c->fc->streams[i]->id;
 frag_stream_info[i].sidx_pts = AV_NOPTS_VALUE;

___
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] fftools/ffmpeg: Free swresample dictionary during cleanup

2020-05-20 Thread Andreas Rheinhardt
ffmpeg | branch: release/4.2 | Andreas Rheinhardt 
 | Thu Oct 24 15:36:35 2019 +0200| 
[f23478aba26c52b057e3a09d5bc0907ddf72c136] | committer: Andreas Rheinhardt

fftools/ffmpeg: Free swresample dictionary during cleanup

Freeing this was forgotten in ad899522.

Fixes #8315 and #8316.

Signed-off-by: Andreas Rheinhardt 
Reviewed-by: Paul B Mahol 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 6f2a3958cfac135c60b509a61a4fd39432d8f9a9)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f23478aba26c52b057e3a09d5bc0907ddf72c136
---

 fftools/ffmpeg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index fa016388e3..a2d2f940f5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -567,6 +567,7 @@ static void ffmpeg_cleanup(int ret)
 ost->audio_channels_mapped = 0;
 
 av_dict_free(>sws_dict);
+av_dict_free(>swr_opts);
 
 avcodec_free_context(>enc_ctx);
 avcodec_parameters_free(>ref_par);

___
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/mediacodec_wrapper: fix {input,output}_buffers global reference leak

2020-05-20 Thread Matthieu Bouron
ffmpeg | branch: release/4.2 | Matthieu Bouron  | 
Thu Apr  9 16:53:21 2020 +0200| [a7b0ab2a23ad461d73072f61ac05feb36c498f36] | 
committer: Matthieu Bouron

avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak

Fixes ticket #8607.

Signed-off-by: Matthieu Bouron 
(cherry picked from commit 5216edbc54c79869ce630579199e53454f96df96)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7b0ab2a23ad461d73072f61ac05feb36c498f36
---

 libavcodec/mediacodec_wrapper.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 5213cf640a..79abc8b6aa 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1303,6 +1303,12 @@ int ff_AMediaCodec_delete(FFAMediaCodec* codec)
 ret = AVERROR_EXTERNAL;
 }
 
+(*env)->DeleteGlobalRef(env, codec->input_buffers);
+codec->input_buffers = NULL;
+
+(*env)->DeleteGlobalRef(env, codec->output_buffers);
+codec->output_buffers = NULL;
+
 (*env)->DeleteGlobalRef(env, codec->object);
 codec->object = NULL;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".