Message ID | 20170910191018.3390-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 380659604f2692b625928a3a76a1c046f473c9f6 |
Headers | show |
On 9/10/17, Michael Niedermayer <michael@niedermayer.cc> wrote: > They are time consuming operations, performing them after the other checks > improves the speed with damaged input dramatically. > > Fixes: Timeout > Fixes: 2928/clusterfuzz-testcase-4992812120539136 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/shorten.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > Probably OK.
On Sun, Sep 10, 2017 at 09:18:37PM +0200, Paul B Mahol wrote: > On 9/10/17, Michael Niedermayer <michael@niedermayer.cc> wrote: > > They are time consuming operations, performing them after the other checks > > improves the speed with damaged input dramatically. > > > > Fixes: Timeout > > Fixes: 2928/clusterfuzz-testcase-4992812120539136 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavcodec/shorten.c | 13 +++++++------ > > 1 file changed, 7 insertions(+), 6 deletions(-) > > > > Probably OK. will apply also will apply the rest of teh patchset thx [...]
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 18b77300a0..49af6beec6 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -462,12 +462,6 @@ static int read_header(ShortenContext *s) } s->nwrap = FFMAX(NWRAP, maxnlpc); - if ((ret = allocate_buffers(s)) < 0) - return ret; - - if ((ret = init_offset(s)) < 0) - return ret; - if (s->version > 1) s->lpcqoffset = V2LPCQOFFSET; @@ -504,6 +498,13 @@ static int read_header(ShortenContext *s) } end: + + if ((ret = allocate_buffers(s)) < 0) + return ret; + + if ((ret = init_offset(s)) < 0) + return ret; + s->cur_chan = 0; s->bitshift = 0;
They are time consuming operations, performing them after the other checks improves the speed with damaged input dramatically. Fixes: Timeout Fixes: 2928/clusterfuzz-testcase-4992812120539136 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/shorten.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)