1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/hdrdec: lines can be empty

Fixes: infinite loop
Fixes: 49223/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HDR_fuzzer-6603308596330496

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>
This commit is contained in:
Michael Niedermayer 2022-07-20 01:14:51 +02:00
parent 636a629ff6
commit 3c43a7a354

View File

@ -107,7 +107,7 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p,
hdr_get_line(&gb, line, sizeof(line));
if (sscanf(line, "PIXASPECT=%f\n", &sar) == 1)
avctx->sample_aspect_ratio = p->sample_aspect_ratio = av_inv_q(av_d2q(sar, 4096));
} while (line[0] != '\n');
} while (line[0] != '\n' && line[0]);
hdr_get_line(&gb, line, sizeof(line));
if (sscanf(line, "-Y %d +X %d\n", &height, &width) == 2) {