[FFmpeg-cvslog] avcodec/hdrdec: lines can be empty

Michael Niedermayer git at videolan.org
Wed Jul 20 17:34:14 EEST 2022


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Jul 20 01:14:51 2022 +0200| [3c43a7a354e8ad9e6a270b592cd7c5c1f3f62110] | committer: Michael Niedermayer

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 at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c43a7a354e8ad9e6a270b592cd7c5c1f3f62110
---

 libavcodec/hdrdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/hdrdec.c b/libavcodec/hdrdec.c
index 458215c6ac..29e87057fa 100644
--- a/libavcodec/hdrdec.c
+++ b/libavcodec/hdrdec.c
@@ -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) {



More information about the ffmpeg-cvslog mailing list