Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported
@ 2023-02-18 23:18 Michael Niedermayer
  2023-02-18 23:18 ` [FFmpeg-devel] [PATCH 2/3] avformat/wavarc: Check if extradata has been fully read Michael Niedermayer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Niedermayer @ 2023-02-18 23:18 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: out of array access
Fixes: 55597/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4898293416329216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/ffv1dec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d74786cec3..180d24e695 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -475,6 +475,11 @@ static int read_extra_header(FFV1Context *f)
         return AVERROR_INVALIDDATA;
     }
 
+    if (f->num_h_slices > MAX_SLICES / f->num_v_slices) {
+        av_log(f->avctx, AV_LOG_ERROR, "slice count unsupported\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     f->quant_table_count = get_symbol(c, state, 0);
     if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
         av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
-- 
2.17.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH 2/3] avformat/wavarc: Check if extradata has been fully read
  2023-02-18 23:18 [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported Michael Niedermayer
@ 2023-02-18 23:18 ` Michael Niedermayer
  2023-02-18 23:18 ` [FFmpeg-devel] [PATCH 3/3] avcodec/wavarc: Check k Michael Niedermayer
  2023-02-23 22:18 ` [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported Michael Niedermayer
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Niedermayer @ 2023-02-18 23:18 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/wavarc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/wavarc.c b/libavformat/wavarc.c
index 208b723716..2b5d1b99eb 100644
--- a/libavformat/wavarc.c
+++ b/libavformat/wavarc.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "demux.h"
 #include "internal.h"
 
@@ -84,7 +85,9 @@ static int wavarc_read_header(AVFormatContext *s)
     if (ret < 0)
         return ret;
     memcpy(par->extradata, data, sizeof(data));
-    avio_read(pb, par->extradata + sizeof(data), fmt_len);
+    ret = ffio_read_size(pb, par->extradata + sizeof(data), fmt_len);
+    if (ret < 0)
+        return ret;
 
     par->codec_type = AVMEDIA_TYPE_AUDIO;
     par->codec_id   = AV_CODEC_ID_WAVARC;
-- 
2.17.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH 3/3] avcodec/wavarc: Check k
  2023-02-18 23:18 [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported Michael Niedermayer
  2023-02-18 23:18 ` [FFmpeg-devel] [PATCH 2/3] avformat/wavarc: Check if extradata has been fully read Michael Niedermayer
@ 2023-02-18 23:18 ` Michael Niedermayer
  2023-02-23 22:18 ` [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported Michael Niedermayer
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Niedermayer @ 2023-02-18 23:18 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: Assertion failure
Fixes: 55849/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-6590105973555200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/wavarc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index b626daa66e..8d37af9571 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -192,6 +192,8 @@ static int decode_1dif(AVCodecContext *avctx,
         if (block_type < 4 && block_type >= 0) {
             k = 1 + (avctx->sample_fmt == AV_SAMPLE_FMT_S16P);
             k = get_urice(gb, k) + 1;
+            if (k > 32)
+                return AVERROR_INVALIDDATA;
         }
 
         switch (block_type) {
@@ -282,6 +284,8 @@ static int decode_2slp(AVCodecContext *avctx,
         if (block_type < 5 && block_type >= 0) {
             k = 1 + (avctx->sample_fmt == AV_SAMPLE_FMT_S16P);
             k = get_urice(gb, k) + 1;
+            if (k > 32)
+                return AVERROR_INVALIDDATA;
         }
 
         switch (block_type) {
-- 
2.17.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported
  2023-02-18 23:18 [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported Michael Niedermayer
  2023-02-18 23:18 ` [FFmpeg-devel] [PATCH 2/3] avformat/wavarc: Check if extradata has been fully read Michael Niedermayer
  2023-02-18 23:18 ` [FFmpeg-devel] [PATCH 3/3] avcodec/wavarc: Check k Michael Niedermayer
@ 2023-02-23 22:18 ` Michael Niedermayer
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Niedermayer @ 2023-02-23 22:18 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 700 bytes --]

On Sun, Feb 19, 2023 at 12:18:48AM +0100, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 55597/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4898293416329216
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ffv1dec.c | 5 +++++
>  1 file changed, 5 insertions(+)

will apply patchset

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-23 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-18 23:18 [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported Michael Niedermayer
2023-02-18 23:18 ` [FFmpeg-devel] [PATCH 2/3] avformat/wavarc: Check if extradata has been fully read Michael Niedermayer
2023-02-18 23:18 ` [FFmpeg-devel] [PATCH 3/3] avcodec/wavarc: Check k Michael Niedermayer
2023-02-23 22:18 ` [FFmpeg-devel] [PATCH 1/3] avcodec/ffv1dec: Check that num h/v slices is supported Michael Niedermayer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git