Commit 5ebaf1e1 authored by Derek Buitenhuis's avatar Derek Buitenhuis

Merge commit '79d89cf2'

* commit '79d89cf2':
  flacenc: Clamp user-supplied min/max prediction orders

  Conflicts:
      libavcodec/flacenc.c
Merged-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parents bba2488f 79d89cf2
...@@ -340,9 +340,10 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) ...@@ -340,9 +340,10 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
} else if (avctx->min_prediction_order >= 0) { } else if (avctx->min_prediction_order >= 0) {
if (s->options.lpc_type == FF_LPC_TYPE_FIXED) { if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
if (avctx->min_prediction_order > MAX_FIXED_ORDER) { if (avctx->min_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n", av_log(avctx, AV_LOG_WARNING,
avctx->min_prediction_order); "invalid min prediction order %d, clamped to %d\n",
return AVERROR(EINVAL); avctx->min_prediction_order, MAX_FIXED_ORDER);
avctx->min_prediction_order = MAX_FIXED_ORDER;
} }
} else if (avctx->min_prediction_order < MIN_LPC_ORDER || } else if (avctx->min_prediction_order < MIN_LPC_ORDER ||
avctx->min_prediction_order > MAX_LPC_ORDER) { avctx->min_prediction_order > MAX_LPC_ORDER) {
...@@ -357,9 +358,10 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) ...@@ -357,9 +358,10 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
} else if (avctx->max_prediction_order >= 0) { } else if (avctx->max_prediction_order >= 0) {
if (s->options.lpc_type == FF_LPC_TYPE_FIXED) { if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
if (avctx->max_prediction_order > MAX_FIXED_ORDER) { if (avctx->max_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n", av_log(avctx, AV_LOG_WARNING,
avctx->max_prediction_order); "invalid max prediction order %d, clamped to %d\n",
return AVERROR(EINVAL); avctx->max_prediction_order, MAX_FIXED_ORDER);
avctx->max_prediction_order = MAX_FIXED_ORDER;
} }
} else if (avctx->max_prediction_order < MIN_LPC_ORDER || } else if (avctx->max_prediction_order < MIN_LPC_ORDER ||
avctx->max_prediction_order > MAX_LPC_ORDER) { avctx->max_prediction_order > MAX_LPC_ORDER) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment