avformat/qcp: Check for read failure in header

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>
This commit is contained in:
Michael Niedermayer 2024-09-23 20:55:17 +02:00
parent 4949e34d96
commit f52b9d0583
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -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)) {