[FFmpeg-devel] [PATCH 2/2] avfilter/signature_lookup: Do not dereference NULL pointers after malloc failure
Michael Niedermayer
michael at niedermayer.cc
Mon Feb 5 13:44:59 EET 2024
Fixes: CID 1403229 Dereference after null check
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavfilter/signature_lookup.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c
index 52a97e1bc7e..0c724456e24 100644
--- a/libavfilter/signature_lookup.c
+++ b/libavfilter/signature_lookup.c
@@ -298,6 +298,11 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont
if (!c->next)
av_log(ctx, AV_LOG_FATAL, "Could not allocate memory");
c = c->next;
+
+ }
+ if (!c) {
+ sll_free(&cands);
+ goto error;
}
c->framerateratio = (i+1.0) / 30;
c->score = hspace[i][j].score;
@@ -314,6 +319,7 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont
}
}
}
+ error:
for (i = 0; i < MAX_FRAMERATE; i++) {
av_freep(&hspace[i]);
}
--
2.17.1
More information about the ffmpeg-devel
mailing list