mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-18 04:47:12 +00:00
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>
This commit is contained in:
parent
ae1156ef2a
commit
db13758b88
@ -2970,6 +2970,8 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
|
|||||||
}
|
}
|
||||||
if (av_log_get_level() >= AV_LOG_DEBUG) {
|
if (av_log_get_level() >= AV_LOG_DEBUG) {
|
||||||
int g = av_gcd(enc->time_base.num, enc->time_base.den);
|
int g = av_gcd(enc->time_base.num, enc->time_base.den);
|
||||||
|
if (!g)
|
||||||
|
g = 1;
|
||||||
snprintf(buf + strlen(buf), buf_size - strlen(buf),
|
snprintf(buf + strlen(buf), buf_size - strlen(buf),
|
||||||
", %d/%d",
|
", %d/%d",
|
||||||
enc->time_base.num / g, enc->time_base.den / g);
|
enc->time_base.num / g, enc->time_base.den / g);
|
||||||
|
Loading…
Reference in New Issue
Block a user