Commit 8e5dd5c728 for ffmpeg
commit 8e5dd5c728e4f49aad2dfb3852e05375d4a0fa12
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Tue Oct 6 07:14:20 2026 +0200
avformat/nistspheredec: Fix the check of ff_alloc_extradata()
The fix is the one recommended in the report.
Fixes: use of uninitialized memory
Fixes: kgMrew6pYynv
Fixes: AISLE-2026-0111-00062
Use of uninitialized memory Replicated through UnModified FFmpeg (ffprobe) with Valgrind
Found-by: Joshua Rogers <joshua.rogers@aisle.com>
diff --git a/libavformat/nistspheredec.c b/libavformat/nistspheredec.c
index e624036149..df58017236 100644
--- a/libavformat/nistspheredec.c
+++ b/libavformat/nistspheredec.c
@@ -36,7 +36,7 @@ static int nist_probe(const AVProbeData *p)
static int nist_read_header(AVFormatContext *s)
{
char buffer[256]= {0}, coding[32] = "pcm", format[32] = "01";
- int bps = 0, be = 0;
+ int bps = 0, be = 0, ret;
int32_t header_size = -1;
AVStream *st;
@@ -73,8 +73,10 @@ static int nist_read_header(AVFormatContext *s)
st->codecpar->codec_id = AV_CODEC_ID_PCM_MULAW;
} else if (!av_strncasecmp(coding, "pcm,embedded-shorten", 20)) {
st->codecpar->codec_id = AV_CODEC_ID_SHORTEN;
- if (ff_alloc_extradata(st->codecpar, 1))
- st->codecpar->extradata[0] = 1;
+ ret = ff_alloc_extradata(st->codecpar, 1);
+ if (ret < 0)
+ return ret;
+ st->codecpar->extradata[0] = 1;
} else {
avpriv_request_sample(s, "coding %s", coding);
}