Skip to content

Commit b92260f

Browse files
committed
avformat/lafdec: Check for EOF in header reading
Fixes: OOM testcase Fixes: 51527/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-5453663505612800 OOM can still happen after this as an arbitrary sized block is allocated and read this would require a redesign or some limit on the sample rate. Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
1 parent 64c6c56 commit b92260f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libavformat/lafdec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ static int laf_read_header(AVFormatContext *ctx)
111111
sample_rate = avio_rl32(pb);
112112
duration = avio_rl64(pb) / st_count;
113113

114+
if (avio_feof(pb))
115+
return AVERROR_INVALIDDATA;
116+
114117
switch (quality) {
115118
case 0:
116119
codec_id = AV_CODEC_ID_PCM_U8;

0 commit comments

Comments
 (0)