[FFmpeg-cvslog] avcodec: avoid division by zero in avcodec_string

Andreas Cadhalpun git at videolan.org
Thu Nov 26 01:54:09 CET 2015


ffmpeg | branch: release/2.4 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Thu Nov 26 01:15:28 2015 +0100| [db13758b88384feb3f430d936a391af452f68313] | committer: Andreas Cadhalpun

avcodec: avoid division by zero in avcodec_string

Actually time_base should not be 0/0, but the proper fix is part of
commit 7ea1b34, which can't be backported, as it changes API.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavcodec/utils.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 12cf577..0901e75 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2970,6 +2970,8 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
             }
             if (av_log_get_level() >= AV_LOG_DEBUG) {
                 int g = av_gcd(enc->time_base.num, enc->time_base.den);
+                if (!g)
+                    g = 1;
                 snprintf(buf + strlen(buf), buf_size - strlen(buf),
                          ", %d/%d",
                          enc->time_base.num / g, enc->time_base.den / g);



More information about the ffmpeg-cvslog mailing list