Browse Source

lavc: check channel count after decoder init

Ensures the decoder did not set channel count to an insanely high value
during initialization, which could cause large memory usage when it tries to
get a buffer during decoding.
tags/n1.1
Justin Ruggles 13 years ago
parent
commit
0366664ef9
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavcodec/utils.c

+ 5
- 0
libavcodec/utils.c View File

@@ -881,6 +881,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
avctx->channel_layout = 0;
}
}
if (avctx->channels && avctx->channels < 0 ||
avctx->channels > FF_SANE_NB_CHANNELS) {
ret = AVERROR(EINVAL);
goto free_and_end;
}
}
end:
entangled_thread_counter--;


Loading…
Cancel
Save