Browse Source

libavformat/oggdec.c: Check return value from avio_read()

If the buffer doesn't contain enough bytes when reading a stream,
fail rather than continuing on with unitialized data. Caught by
Chromium fuzzers (crbug.com/1054229).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b7c67b1ae3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.0.6
John Rummell Michael Niedermayer 5 years ago
parent
commit
b561b503ff
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavformat/oggdec.c

+ 2
- 1
libavformat/oggdec.c View File

@@ -216,7 +216,8 @@ static int ogg_replace_stream(AVFormatContext *s, uint32_t serial, int nsegs)
uint8_t magic[8];
int64_t pos = avio_tell(s->pb);
avio_skip(s->pb, nsegs);
avio_read(s->pb, magic, sizeof(magic));
if (avio_read(s->pb, magic, sizeof(magic)) != sizeof(magic))
return AVERROR_INVALIDDATA;
avio_seek(s->pb, pos, SEEK_SET);
codec = ogg_find_codec(magic, sizeof(magic));
if (!codec) {


Loading…
Cancel
Save