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>
This commit is contained in:
Kacper Michajłow 2024-06-25 23:50:30 +02:00 committed by Michael Niedermayer
parent 6aeb084c39
commit 02b3fc5826
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 3 additions and 1 deletions

View File

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