Re: [FFmpeg-devel] [PATCH 5/9] avcodec/vc1: Check remaining bits in ff_vc1_parse_frame_header()

2021-05-12 Thread Michael Niedermayer
On Mon, Apr 19, 2021 at 08:23:42PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 33156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-6259655027326976
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/vc1.c | 5 +
>  1 file changed, 5 insertions(+)

will apply

[...]
-- 
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


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 5/9] avcodec/vc1: Check remaining bits in ff_vc1_parse_frame_header()

2021-04-19 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
33156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-6259655027326976

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

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index b7140c089c..40e2b4d692 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -672,6 +672,8 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* 
gb)
 if (v->s.pict_type == AV_PICTURE_TYPE_P)
 v->rnd ^= 1;
 
+if (get_bits_left(gb) < 5)
+return AVERROR_INVALIDDATA;
 /* Quantizer stuff */
 pqindex = get_bits(gb, 5);
 if (!pqindex)
@@ -764,6 +766,9 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* 
gb)
 av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
"Imode: %i, Invert: %i\n", status>>1, status&1);
 
+if (get_bits_left(gb) < 4)
+return AVERROR_INVALIDDATA;
+
 /* Hopefully this is correct for P-frames */
 v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
 v->cbptab = get_bits(gb, 2);
-- 
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-requ...@ffmpeg.org with subject "unsubscribe".