[FFmpeg-cvslog] avcodec/utils: Check close before calling it

2021-01-02 Thread Michael Niedermayer
ffmpeg | branch: release/3.2 | Michael Niedermayer  | 
Sun Jul 21 00:08:55 2019 +0200| [cb456b8fb00e04bedf117cb4b72c87a9c3db5145] | 
committer: James Almer

avcodec/utils: Check close before calling it

Fixes: NULL pointer dereference
Fixes: 
15733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IDF_fuzzer-5658616977162240

Reviewed-by: Paul B Mahol 
Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 8df6884832ec413cf032dfaa45c23b1c7876670c)

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

 libavcodec/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8f19237d3f..c8f4ff7973 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1720,7 +1720,7 @@ end:
 
 return ret;
 free_and_end:
-if (avctx->codec &&
+if (avctx->codec && avctx->codec->close &&
 (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP))
 avctx->codec->close(avctx);
 

___
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/videotoolbox: make FFmpeg-to-VT mapping error more informative

2021-01-02 Thread Jan Ekström
ffmpeg | branch: master | Jan Ekström  | Sat Jan  2 14:30:36 
2021 +0200| [ed524136e0d0ae26c9f11df42baf72689499f99f] | committer: Jan Ekström

avcodec/videotoolbox: make FFmpeg-to-VT mapping error more informative

Now logs the actual failed-to-map pixel format as well as range.

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

 libavcodec/videotoolbox.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 8773de3393..49e726a75f 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1088,7 +1088,13 @@ static int videotoolbox_common_init(AVCodecContext 
*avctx)
 vtctx->vt_ctx->cv_pix_fmt_type =
 av_map_videotoolbox_format_from_pixfmt2(hw_frames->sw_format, 
full_range);
 if (!vtctx->vt_ctx->cv_pix_fmt_type) {
-av_log(avctx, AV_LOG_ERROR, "Unknown sw_format.\n");
+const AVPixFmtDescriptor *attempted_format =
+av_pix_fmt_desc_get(hw_frames->sw_format);
+av_log(avctx, AV_LOG_ERROR,
+   "Failed to map underlying FFmpeg pixel format %s (%s range) to "
+   "a VideoToolbox format!\n",
+   attempted_format ? attempted_format->name : "",
+   av_color_range_name(avctx->color_range));
 err = AVERROR(EINVAL);
 goto fail;
 }

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

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

[FFmpeg-cvslog] avcodec/notchlc: Check uncompressed size against input for LZ4

2021-01-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Oct 14 17:53:07 2020 +0200| [32d0561891e1a78f9bd18ad667ca526ab1600a06] | 
committer: Michael Niedermayer

avcodec/notchlc: Check uncompressed size against input for LZ4

Fixes: OOM
Fixes: 
26168/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-6019839015256064
Fixes: 
28397/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-5649039941042176

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavcodec/notchlc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index 57ce70e945..9a53cad9cb 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -496,6 +496,9 @@ static int decode_frame(AVCodecContext *avctx,
 
 bytestream2_init(gb, s->lzf_buffer, uncompressed_size);
 } else if (s->format == 1) {
+if (bytestream2_get_bytes_left(gb) < uncompressed_size / 255)
+return AVERROR_INVALIDDATA;
+
 av_fast_padded_malloc(&s->uncompressed_buffer, &s->uncompressed_size,
   uncompressed_size);
 if (!s->uncompressed_buffer)

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

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

[FFmpeg-cvslog] avformat/wavdec: Avoid zeroing written to array

2021-01-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Nov  9 20:53:27 2020 +0100| [f26b5acfc03375c96e593197a8145ada1b63b1fd] | 
committer: Michael Niedermayer

avformat/wavdec: Avoid zeroing written to array

Fixes: OOM
Fixes: 
26934/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5996784213819392

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

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

 libavformat/wavdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 35c5e442a8..3da4150f05 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -917,7 +917,7 @@ static int w64_read_header(AVFormatContext *s)
 if (chunk_size == UINT32_MAX || (filesize >= 0 && chunk_size > 
filesize))
 return AVERROR_INVALIDDATA;
 
-value = av_mallocz(chunk_size + 1);
+value = av_malloc(chunk_size + 1);
 if (!value)
 return AVERROR(ENOMEM);
 

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

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