diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-16 23:56:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-05-09 11:18:13 +0200 |
commit | b5b12e2189b4ed6527b43a4924c67e3b847d2a51 (patch) | |
tree | 8c9851ca80901fee7de7c823b0f733afcc4effb0 | |
parent | 0dd99b0238089c06c429e9658e7506eb44c0b083 (diff) | |
download | ffmpeg-b5b12e2189b4ed6527b43a4924c67e3b847d2a51.tar.gz |
avformat/aadec: Check for scanf() failure
Fixes: use of uninitialized variables
Fixes: blank.aa
Found-by: Chamal De Silva <chamal.desilva@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ed188f6dcdf0935c939ed813cf8745d50742014b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/aadec.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/aadec.c b/libavformat/aadec.c index cf5f3d107a..fc5363d51d 100644 --- a/libavformat/aadec.c +++ b/libavformat/aadec.c @@ -78,6 +78,7 @@ static int aa_read_header(AVFormatContext *s) AADemuxContext *c = s->priv_data; AVIOContext *pb = s->pb; AVStream *st; + int ret; /* parse .aa header */ avio_skip(pb, 4); // file size @@ -121,7 +122,10 @@ static int aa_read_header(AVFormatContext *s) } if (!strcmp(key, "HeaderKey")) { // this looks like "1234567890 1234567890 1234567890 1234567890" av_log(s, AV_LOG_DEBUG, "HeaderKey is <%s>\n", val); - sscanf(val, "%u%u%u%u", &header_key_part[0], &header_key_part[1], &header_key_part[2], &header_key_part[3]); + ret = sscanf(val, "%u%u%u%u", &header_key_part[0], &header_key_part[1], &header_key_part[2], &header_key_part[3]); + if (ret != 4) + return AVERROR_INVALIDDATA; + for (idx = 0; idx < 4; idx++) { AV_WB32(&header_key[idx * 4], header_key_part[idx]); // convert each part to BE! } |