diff mbox series

[FFmpeg-devel,3/7] avcodec/setts_bsf: Check timebase

Message ID 20210304184839.24847-3-michael@niedermayer.cc
State Accepted
Commit 7fc8ba9068abc4c4cb3fbca4a25b53710ec374b6
Headers show
Series [FFmpeg-devel,1/7] avformat/utils: Fix integer overflow with duration_gcd in ff_rfps_calculate()
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer March 4, 2021, 6:48 p.m. UTC
Fixes: Division by 0
Fixes: 30952/clusterfuzz-testcase-minimized-ffmpeg_BSF_SETTS_fuzzer-6601016202100736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/setts_bsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/setts_bsf.c b/libavcodec/setts_bsf.c
index 5b6b256915..2558e38f51 100644
--- a/libavcodec/setts_bsf.c
+++ b/libavcodec/setts_bsf.c
@@ -152,7 +152,7 @@  static int setts_filter(AVBSFContext *ctx, AVPacket *pkt)
     s->var_values[VAR_PREV_OUTDTS] = s->prev_outdts;
     s->var_values[VAR_STARTPTS]    = s->start_pts;
     s->var_values[VAR_STARTDTS]    = s->start_dts;
-    s->var_values[VAR_TB]          = av_q2d(ctx->time_base_out);
+    s->var_values[VAR_TB]          = ctx->time_base_out.den ? av_q2d(ctx->time_base_out) : 0;
     s->var_values[VAR_SR]          = ctx->par_in->sample_rate;
 
     new_ts = llrint(av_expr_eval(s->ts_expr, s->var_values, NULL));