aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-08-04 21:27:44 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-08-14 18:21:00 +0200
commit66ee75d76ce56a3553a99d67e74b8a9970c18f5b (patch)
tree2c49515c69542e2f6edb2468126591f29db41658
parent8ca072a373f5e2b6689a8649c79a03d12db5eb0b (diff)
downloadffmpeg-66ee75d76ce56a3553a99d67e74b8a9970c18f5b.tar.gz
avformat/mpeg: Check an avio_read() for failure
Fixes: use-of-uninitialized-value Fixes: 70849/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGPS_fuzzer-4684401009557504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mpeg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index c3dff3e4ea..2c766a4ee9 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -566,7 +566,9 @@ redo:
static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
unsigned char buf[8];
- avio_read(s->pb, buf, 8);
+ ret = avio_read(s->pb, buf, 8);
+ if (ret != 8)
+ return AVERROR_INVALIDDATA;
avio_seek(s->pb, -8, SEEK_CUR);
if (!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
codec_id = AV_CODEC_ID_CAVS;