[FFmpeg-devel] [PATCH] avfilter/xpsnr: avoid division by zero
Gyan Doshi
ffmpeg at gyani.pro
Mon Jan 27 07:28:01 EET 2025
The ref input may have its frame rate unset, which would then lead to
SIGFPE.
Related to #11428
---
libavfilter/vf_xpsnr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavfilter/vf_xpsnr.c b/libavfilter/vf_xpsnr.c
index 1b2c2a7c2c..8f86c188c5 100644
--- a/libavfilter/vf_xpsnr.c
+++ b/libavfilter/vf_xpsnr.c
@@ -568,7 +568,8 @@ static int config_input_ref(AVFilterLink *inlink)
s->max_error_64 = (1 << s->depth) - 1; /* conventional limit */
s->max_error_64 *= s->max_error_64;
- s->frame_rate = il->frame_rate.num / il->frame_rate.den;
+ // Avoid division by zero
+ s->frame_rate = il->frame_rate.den ? (il->frame_rate.num / il->frame_rate.den) : 25;
s->num_comps = (desc->nb_components > 3 ? 3 : desc->nb_components);
--
2.46.1
More information about the ffmpeg-devel
mailing list