[FFmpeg-devel] [PATCH 2/3] avcodec/mpeg12: Don't pretend reading dct_dc_size_* VLCs can fail

Michael Niedermayer michael at niedermayer.cc
Sat Oct 10 19:04:08 EEST 2020


On Sat, Oct 10, 2020 at 12:08:20AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > On Thu, Oct 08, 2020 at 09:53:12PM +0200, Andreas Rheinhardt wrote:
> >> It can't because the corresponding trees don't have any loose ends.
> >>
> >> Removing the checks also removed an instance of av_log(NULL (with a
> >> nonsense message) from the codebase.
> >>
> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> >> ---
> >>  libavcodec/mdec.c      | 2 --
> >>  libavcodec/mpeg12.h    | 4 ----
> >>  libavcodec/mpeg12dec.c | 4 ----
> >>  3 files changed, 10 deletions(-)
> > 
> > It is possible to encode nonsensical dc differnces, these could be checked
> > for and trigger errors. Not in the current codebase no, but one could add
> > a check for it
> > Without such checks, your patch is probably ok
> > 
> It is not possible to encode a nonsense difference. The standard has a
> requirement that predictor (last_dc[component] in our code) + diff be in
> a certain range, but that is a check that should be performed at the
> place where the addition is performed; decode_dc() (in its current form)
> simply lacks the context to know whether the diff it parsed will make
> the sum violate this requirement.

Some VLC codecs are invalid in lower bit per DC files (IIRC thats most)
These could be removed from the VLC table used to decode them.
no additional context is needed in decode_dc() for that

Of course checking the DC outside works better and we should prefer that

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- 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/20201010/4e40efa1/attachment.sig>


More information about the ffmpeg-devel mailing list