X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fbintext.c;h=61b89f56d6b4788746f757e8d155733ef36119ce;hb=632b8298b70969f6ab43509fd276b33295d9e336;hp=0b499d9555ed8d84cd376c4098a170f362c74406;hpb=0a319bcce5714f7183b0537892f7d37d7a31493a;p=ffmpeg diff --git a/libavformat/bintext.c b/libavformat/bintext.c index 0b499d9555e..61b89f56d6b 100644 --- a/libavformat/bintext.c +++ b/libavformat/bintext.c @@ -126,7 +126,7 @@ static void predict_width(AVCodecParameters *par, uint64_t fsize, int got_width) par->width = fsize > 4000 ? (160<<3) : (80<<3); } -static int bin_probe(AVProbeData *p) +static int bin_probe(const AVProbeData *p) { const uint8_t *d = p->buf; int magic = 0, sauce = 0; @@ -149,7 +149,7 @@ static int bin_probe(AVProbeData *p) return AVPROBE_SCORE_EXTENSION + 1; predict_width(&par, p->buf_size, got_width); - if (par.width <= 0) + if (par.width < 8) return 0; calculate_height(&par, p->buf_size); if (par.height <= 0) @@ -195,6 +195,8 @@ static int bintext_read_header(AVFormatContext *s) next_tag_read(s, &bin->fsize); if (!bin->width) { predict_width(st->codecpar, bin->fsize, got_width); + if (st->codecpar->width < 8) + return AVERROR_INVALIDDATA; calculate_height(st->codecpar, bin->fsize); } avio_seek(pb, 0, SEEK_SET); @@ -204,7 +206,7 @@ static int bintext_read_header(AVFormatContext *s) #endif /* CONFIG_BINTEXT_DEMUXER */ #if CONFIG_XBIN_DEMUXER -static int xbin_probe(AVProbeData *p) +static int xbin_probe(const AVProbeData *p) { const uint8_t *d = p->buf; @@ -302,7 +304,7 @@ static const uint8_t idf_magic[] = { 0x04, 0x31, 0x2e, 0x34, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x15, 0x00 }; -static int idf_probe(AVProbeData *p) +static int idf_probe(const AVProbeData *p) { if (p->buf_size < sizeof(idf_magic)) return 0;