diff options
author | Thierry Foucu <tfoucu@gmail.com> | 2020-08-19 15:51:02 -0700 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-08-20 13:27:22 +0200 |
commit | 36f7b83568764ae73d0c7b3a43f1e3d3df234033 (patch) | |
tree | afa1c805ab545b6e25bca82ab3dcf108dcf3c915 | |
parent | a606e3b3393dec611f3830d2397651a943280546 (diff) | |
download | ffmpeg-36f7b83568764ae73d0c7b3a43f1e3d3df234033.tar.gz |
libavformat/r3d.c: Fix Use-of-uninitialized-value in filename.
While reading the filename tag, it may return a EOF and we are still
copying the file with uninitialized value.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/r3d.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 7aa0c5a2c3..606ed010d6 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -56,6 +56,7 @@ static int r3d_read_red1(AVFormatContext *s) R3DContext *r3d = s->priv_data; char filename[258]; int tmp; + int ret; int av_unused tmp2; AVRational framerate; @@ -97,7 +98,9 @@ static int r3d_read_red1(AVFormatContext *s) r3d->audio_channels = avio_r8(s->pb); // audio channels av_log(s, AV_LOG_TRACE, "audio channels %d\n", tmp); - avio_read(s->pb, filename, 257); + ret = avio_read(s->pb, filename, 257); + if (ret < 257) + return ret < 0 ? ret : AVERROR_EOF; filename[sizeof(filename)-1] = 0; av_dict_set(&st->metadata, "filename", filename, 0); |