[FFmpeg-devel] avcodec/vp3: Check that theora is theora

Submitted by Michael Niedermayer on July 24, 2019, 12:40 p.m.

Details

Message ID 20190724124008.2437-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer July 24, 2019, 12:40 p.m.
Theora is forced to be non zero if it is zero and a sample
is asked for, as suggested by reimar

Fixes: Timeout (2min -> 600ms)
Fixes: 15366/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5737849938247680

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

Comments

Michael Niedermayer Aug. 3, 2019, 10:13 a.m.
On Wed, Jul 24, 2019 at 02:40:08PM +0200, Michael Niedermayer wrote:
> Theora is forced to be non zero if it is zero and a sample
> is asked for, as suggested by reimar
> 
> Fixes: Timeout (2min -> 600ms)
> Fixes: 15366/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5737849938247680
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vp3.c | 4 ++++
>  1 file changed, 4 insertions(+)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index a6f759ebf5..6ce901eda9 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2957,6 +2957,10 @@  static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
     s->theora_header = 0;
     s->theora = get_bits_long(gb, 24);
     av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
+    if (!s->theora) {
+        s->theora = 1;
+        avpriv_request_sample(s->avctx, "theora 0");
+    }
 
     /* 3.2.0 aka alpha3 has the same frame orientation as original vp3
      * but previous versions have the image flipped relative to vp3 */