History

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.

Andreas Rheinhardt committed 5 years ago

Commit d393c451 parent 6e8e9b71 file · +1 −1Browse files

Unified · Split

libavcodec/mpegvideo_enc.c+1−1
@@ -627,7 +627,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 626 unmodified lines
627#if FF_API_PRIVATE_OPT627#if FF_API_PRIVATE_OPT
628 FF_DISABLE_DEPRECATION_WARNINGS628 FF_DISABLE_DEPRECATION_WARNINGS
629 if (avctx->mpeg_quant)629 if (avctx->mpeg_quant)
630 s->mpeg_quant = avctx->mpeg_quant;630 s->mpeg_quant = 1;
631 FF_ENABLE_DEPRECATION_WARNINGS631 FF_ENABLE_DEPRECATION_WARNINGS
632#endif632#endif
633 633

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t