[FFmpeg-devel] [PATCH] avcodec/movtextdec: Check style_start/end

Michael Niedermayer michael at niedermayer.cc
Mon Apr 9 00:48:47 EEST 2018


On Sat, Apr 07, 2018 at 08:33:11PM -0700, Philip Langdale wrote:
> On Sun,  8 Apr 2018 03:29:44 +0200
> Michael Niedermayer <michael at niedermayer.cc> wrote:
> 
> > Limits based on 3GPP TS 26.245 V14.0.0
> > Fixes: Timeout
> > Fixes:
> > 6377/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOVTEXT_fuzzer-5175929115508736
> > 
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc> ---
> >  libavcodec/movtextdec.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> > index 89ac791602..c38c5edce6 100644
> > --- a/libavcodec/movtextdec.c
> > +++ b/libavcodec/movtextdec.c
> > @@ -299,6 +299,14 @@ static int decode_styl(const uint8_t *tsmb,
> > MovTextContext *m, AVPacket *avpkt) m->s_temp->style_start =
> > AV_RB16(tsmb); tsmb += 2;
> >          m->s_temp->style_end = AV_RB16(tsmb);
> > +
> > +        if (   m->s_temp->style_end < m->s_temp->style_start
> > +            || (m->count_s && m->s_temp->style_start <
> > m->s[m->count_s - 1]->style_end)) {
> > +            av_freep(&m->s_temp);
> > +            mov_text_cleanup(m);
> > +            return AVERROR(ENOMEM);
> > +        }
> > +
> >          tsmb += 2;
> >          m->s_temp->style_fontID = AV_RB16(tsmb);
> >          tsmb += 2;
> 
> LGTM.

will apply

thx

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180408/57150c23/attachment.sig>


More information about the ffmpeg-devel mailing list