[FFmpeg-devel] [PATCH] avfilter: Fixes null pointer dereference

lance.lmwang at gmail.com lance.lmwang at gmail.com
Fri May 15 04:33:46 EEST 2020


From: Limin Wang <lance.lmwang at gmail.com>

This bug was introduced in commit: 339593ca90cb3e05d659ec99a1479904ec742294 and 
339593ca90cb3e05d659ec99a1479904ec742294.

Reported-by: Marton Balint <cus at passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavfilter/vf_framerate.c    | 2 +-
 libavfilter/vf_minterpolate.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c
index 8d16998..a84578a 100644
--- a/libavfilter/vf_framerate.c
+++ b/libavfilter/vf_framerate.c
@@ -80,7 +80,7 @@ static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next
         e_mafd = av_dict_get(next->metadata, "lavfi.scd.mafd", NULL, AV_DICT_MATCH_CASE);
         if (e_mafd)
             mafd = strtod(e_mafd->value, &tail);
-        if (*tail || mafd == HUGE_VAL) {
+        if (!tail || *tail || mafd == HUGE_VAL) {
             s->sad(crnt->data[0], crnt->linesize[0], next->data[0], next->linesize[0], crnt->width, crnt->height, &sad);
             emms_c();
             mafd = (double)sad * 100.0 / (crnt->width * crnt->height) / (1 << s->bitdepth);
diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c
index ef47140..df27c53 100644
--- a/libavfilter/vf_minterpolate.c
+++ b/libavfilter/vf_minterpolate.c
@@ -842,7 +842,7 @@ static int detect_scene_change(MIContext *mi_ctx)
         e_mafd = av_dict_get(mi_ctx->frames[2].avf->metadata, "lavfi.scd.mafd", NULL, AV_DICT_MATCH_CASE);
         if (e_mafd)
             mafd = strtod(e_mafd->value, &tail);
-        if (*tail || mafd == HUGE_VAL) {
+        if (!tail || *tail || mafd == HUGE_VAL) {
             mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad);
             emms_c();
             mafd = (double) sad * 100.0 / (me_ctx->height * me_ctx->width) / (1 << mi_ctx->bitdepth);
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list