[FFmpeg-devel] [PATCH 12/19] avcodec/mpegvideo_enc: Don't segfault on unorthodox mpeg_quant

Michael Niedermayer michael at niedermayer.cc
Thu Apr 8 01:25:43 EEST 2021


On Thu, Apr 08, 2021 at 12:17:04AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > On Wed, Apr 07, 2021 at 11:07:54PM +0200, Andreas Rheinhardt wrote:
> >> Michael Niedermayer:
> >>> On Tue, Apr 06, 2021 at 11:55:09PM +0200, Andreas Rheinhardt wrote:
> >>>> 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 at outlook.com>
> >>>> ---
> >>>> This can not be triggered if one only sets options via the dictionary in
> >>>> avcodec_open2(); one needs to set it directly in the AVCodecContext or
> >>>> use the private class of AVCodecContext.
> >>>
> >>> I tend toward checking mpeg_quant to be valid in init somewhere but this
> >>> here is fine too or in addition
> >>>
> >> Do you want to error out if AVCodecContext.mpeg_quant is outside of
> >> 0..1? 
> > 
> > that was the idea, i did not test this though 
> > 
> 
> I think it's not worth it for an option that will be removed on the next
> bump (AVCodecContext.mpeg_quant is deprecated).

ok then forget about the idea


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210408/a86a0820/attachment.sig>


More information about the ffmpeg-devel mailing list