Re: [FFmpeg-devel] [PATCH 3/6] avcodec/rv10: Check input for minimal frame size

2019-11-01 Thread Michael Niedermayer
On Wed, Oct 09, 2019 at 12:14:51PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (18sec -> 4sec)
> Fixes: 
> 18012/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV20_fuzzer-5767486145822720
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/rv10.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)

will apply this and the rest of the patch which isnt applied yet


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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP signature
___
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 3/6] avcodec/rv10: Check input for minimal frame size

2019-10-09 Thread Michael Niedermayer
Fixes: Timeout (18sec -> 4sec)
Fixes: 
18012/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV20_fuzzer-5767486145822720

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/rv10.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 729e4a8d2c..3b41d30b92 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -550,7 +550,7 @@ static av_cold int rv10_decode_end(AVCodecContext *avctx)
 }
 
 static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
-  int buf_size, int buf_size2)
+  int buf_size, int buf_size2, int whole_size)
 {
 RVDecContext *rv = avctx->priv_data;
 MpegEncContext *s = >m;
@@ -580,6 +580,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, const 
uint8_t *buf,
 return AVERROR_INVALIDDATA;
 }
 
+if (whole_size < s->mb_width * s->mb_height / 8)
+return AVERROR_INVALIDDATA;
+
 if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) {
 // FIXME write parser so we always have complete frames?
 if (s->current_picture_ptr) {
@@ -754,7 +757,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 offset + FFMAX(size, size2) > buf_size)
 return AVERROR_INVALIDDATA;
 
-if ((ret = rv10_decode_packet(avctx, buf + offset, size, size2)) < 0)
+if ((ret = rv10_decode_packet(avctx, buf + offset, size, size2, 
buf_size)) < 0)
 return ret;
 
 if (ret > 8 * size)
-- 
2.23.0

___
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".