[FFmpeg-cvslog] avfilter/signature_lookup: Do not dereference NULL pointers after malloc failure

Michael Niedermayer git at videolan.org
Sun Apr 14 04:43:26 EEST 2024


ffmpeg | branch: release/6.1 | Michael Niedermayer <michael at niedermayer.cc> | Mon Feb  5 12:40:30 2024 +0100| [fdc5b25f19fae6615cc9d7139175c0de58115185] | committer: Michael Niedermayer

avfilter/signature_lookup: Do not dereference NULL pointers after malloc failure

Fixes: CID 1403229 Dereference after null check

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 98ae1ad7cf16bd10a4fa79f676439edc4da7cba6)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fdc5b25f19fae6615cc9d7139175c0de58115185
---

 libavfilter/signature_lookup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c
index 3c7006c9d6..ad012ecced 100644
--- a/libavfilter/signature_lookup.c
+++ b/libavfilter/signature_lookup.c
@@ -299,6 +299,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;
@@ -315,6 +320,7 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont
             }
         }
     }
+    error:
     for (i = 0; i < MAX_FRAMERATE; i++) {
         av_freep(&hspace[i]);
     }



More information about the ffmpeg-cvslog mailing list