aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2024-06-25 23:50:30 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-06-27 23:28:46 +0200
commit02b3fc582693477555ce151515972bfee04367a9 (patch)
treef49694bebb22b7ca3dae22f1abb3684057cbd436
parent6aeb084c395dd3240e203d7b6a053cbdfec2ac99 (diff)
downloadffmpeg-02b3fc582693477555ce151515972bfee04367a9.tar.gz
avformat/nuv: return early if header id fails to read
Fixes use of uninitialized value in memcmp below, reported by MSAN. Found by OSS-Fuzz. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/nuv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 507a73b0fe..49915ecf16 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -165,7 +165,9 @@ static int nuv_header(AVFormatContext *s)
int is_mythtv, width, height, v_packs, a_packs, ret;
AVStream *vst = NULL, *ast = NULL;
- avio_read(pb, id_string, 12);
+ if ((ret = ffio_read_size(pb, id_string, 12)) < 0)
+ return ret;
+
is_mythtv = !memcmp(id_string, "MythTVVideo", 12);
avio_skip(pb, 5); // version string
avio_skip(pb, 3); // padding