avcodec/shorten: Move buffer allocation and offset init to end of read_header()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 10 Sep 2017 19:10:16 +0000 (21:10 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 11 Sep 2017 23:54:00 +0000 (01:54 +0200)
commit0c5eb03aac6fd31ebb3e4ec263b18de30836c5a2
treedf08adc88fd8868e62f230e91ff6ceb4f1289391
parenteca53fd52bdc22a74ab6552bcc2c50ee591c43f0
avcodec/shorten: Move buffer allocation and offset init to end of read_header()

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
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 380659604f2692b625928a3a76a1c046f473c9f6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/shorten.c