[FFmpeg-cvslog] avformat/bintext: avoid division by zero

Paul B Mahol git at videolan.org
Sun Jan 19 14:48:02 EET 2020


ffmpeg | branch: release/4.2 | Paul B Mahol <onemda at gmail.com> | Fri Oct 25 12:16:29 2019 +0200| [19bfd7212695b456352e258c9ee50882583ce12f] | committer: Carl Eugen Hoyos

avformat/bintext: avoid division by zero

Fixes #8335

(cherry picked from commit 9d711a90fdf379dca2b3d24893c820c3060b5d94)

Fixes ticket #8484.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=19bfd7212695b456352e258c9ee50882583ce12f
---

 libavformat/bintext.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/bintext.c b/libavformat/bintext.c
index d4921749a0..61b89f56d6 100644
--- a/libavformat/bintext.c
+++ b/libavformat/bintext.c
@@ -149,7 +149,7 @@ static int bin_probe(const 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);



More information about the ffmpeg-cvslog mailing list