1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/hevc_mp4toannexb_bsf: Check nalu_size

Fixes: Timeout (29sec -> 5ms)
Fixes: 20237/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_MP4TOANNEXB_fuzzer-5165615044362240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-04-19 18:24:55 +02:00
parent e58766ba12
commit ae2537f53e

View File

@ -144,6 +144,11 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
for (i = 0; i < s->length_size; i++) for (i = 0; i < s->length_size; i++)
nalu_size = (nalu_size << 8) | bytestream2_get_byte(&gb); nalu_size = (nalu_size << 8) | bytestream2_get_byte(&gb);
if (nalu_size < 2) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
nalu_type = (bytestream2_peek_byte(&gb) >> 1) & 0x3f; nalu_type = (bytestream2_peek_byte(&gb) >> 1) & 0x3f;
/* prepend extradata to IRAP frames */ /* prepend extradata to IRAP frames */