Browse Source

avcodec/mpegvideo_enc: Don't segfault on unorthodox mpeg_quant

The (deprecated) field AVCodecContext.mpeg_quant has no range
restriction; MpegEncContext.mpeg_quant is restricted to 0..1.
If the former is set, the latter is overwritten with it without
checking the range. This can trigger an av_assert2() with the MPEG-4
encoder when writing said field.

Fix this by just setting MpegEncContext.mpeg_quant to 1 if
AVCodecContext.mpeg_quant is set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
master
Andreas Rheinhardt 4 years ago
parent
commit
d393c45051
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/mpegvideo_enc.c

+ 1
- 1
libavcodec/mpegvideo_enc.c View File

@@ -627,7 +627,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
#if FF_API_PRIVATE_OPT #if FF_API_PRIVATE_OPT
FF_DISABLE_DEPRECATION_WARNINGS FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->mpeg_quant) if (avctx->mpeg_quant)
s->mpeg_quant = avctx->mpeg_quant;
s->mpeg_quant = 1;
FF_ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS
#endif #endif




Loading…
Cancel
Save