aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-26 01:15:28 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-26 01:38:18 +0100
commitdb13758b88384feb3f430d936a391af452f68313 (patch)
tree855ee90e71b9c8e167b1e72a67e743d166d7a550
parentae1156ef2aa36b1b0e61787a52f5e06487bb1056 (diff)
downloadffmpeg-db13758b88384feb3f430d936a391af452f68313.tar.gz
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@googlemail.com>
-rw-r--r--libavcodec/utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 12cf577343..0901e75d85 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);