diff mbox series

[FFmpeg-devel,5/7] avformat/qcp: Check for read failure in header

Message ID 20240923213249.3256534-5-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/7] avcodec/ilbcdec: Initialize tempbuff2 | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Sept. 23, 2024, 9:32 p.m. UTC
Fixes: Use of uninitialized value
Fixes: 71551/clusterfuzz-testcase-minimized-ffmpeg_dem_QCP_fuzzer-4647386712965120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/qcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/qcp.c b/libavformat/qcp.c
index fdf18618d23..13a479a11e6 100644
--- a/libavformat/qcp.c
+++ b/libavformat/qcp.c
@@ -105,7 +105,8 @@  static int qcp_read_header(AVFormatContext *s)
 
     st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codecpar->ch_layout  = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
-    avio_read(pb, buf, 16);
+    if (avio_read(pb, buf, 16) != 16)
+        return AVERROR_INVALIDDATA;
     if (is_qcelp_13k_guid(buf)) {
         st->codecpar->codec_id = AV_CODEC_ID_QCELP;
     } else if (!memcmp(buf, guid_evrc, 16)) {