Browse Source

avcodec/cngdec: Check skip_samples

Without this its possible to make the new decode API decode billions of samples
out of a empty input and never return to the caller before all samples have been
created and discarded.

Fixes: Timeout
Fixes: 2992/clusterfuzz-testcase-6649611793989632

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.4
Michael Niedermayer 8 years ago
parent
commit
e7b9d136a1
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      libavcodec/cngdec.c

+ 6
- 0
libavcodec/cngdec.c View File

@@ -23,6 +23,7 @@

#include "libavutil/common.h"
#include "libavutil/ffmath.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "celp_filters.h"
#include "internal.h"
@@ -120,6 +121,11 @@ static int cng_decode_frame(AVCodecContext *avctx, void *data,
}
}

if (avctx->internal->skip_samples > 10 * avctx->frame_size) {
avctx->internal->skip_samples = 0;
return AVERROR_INVALIDDATA;
}

if (p->inited) {
p->energy = p->energy / 2 + p->target_energy / 2;
for (i = 0; i < p->order; i++)


Loading…
Cancel
Save