]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix NULL pointer dereference in tvh_context_helper_find
authorcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Tue, 23 Sep 2025 11:41:01 +0000 (11:41 +0000)
committercopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Tue, 23 Sep 2025 11:41:01 +0000 (11:41 +0000)
Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com>
src/transcoding/codec/codecs/libs/libx26x.c
src/transcoding/transcode/helpers.c

index bd60d3e6098862a7b74d1eaf798c36ae16eab184..abe3ca443289f03fbba951328e693d73fa2b1c7e 100644 (file)
@@ -137,11 +137,6 @@ tvh_codec_profile_libx264_open(tvh_codec_profile_libx26x_t *self,
     else {
         AV_DICT_SET_CRF(opts, self->crf, 15);
     }
-    // Set default profile if not specified (to avoid profile 0 error)
-    TVHCodecProfile *base_profile = (TVHCodecProfile *)self;
-    if (base_profile->profile == FF_AV_PROFILE_UNKNOWN) {
-        AV_DICT_SET(opts, "profile", "baseline", AV_DICT_DONT_OVERWRITE);
-    }
     // params
     if (self->params && strlen(self->params)) {
         AV_DICT_SET(opts, "x264-params", self->params, 0);
@@ -217,7 +212,6 @@ TVHVideoCodec tvh_codec_libx264 = {
     .size     = sizeof(tvh_codec_profile_libx26x_t),
     .idclass  = &codec_profile_libx264_class,
     .profiles = libx264_profiles,
-    .profile_init = tvh_codec_profile_video_init,
     .profile_destroy = tvh_codec_profile_libx265_destroy,
 };
 
index 025512f63c695548eb2636ed5f77ed166a5a074b..e54e420666eeed39dbd6ae96766d01a14b44d1eb 100644 (file)
@@ -70,6 +70,10 @@ tvh_context_helper_find(struct TVHContextHelpers *list, const AVCodec *codec)
 {
     TVHContextHelper *helper = NULL;
 
+    if (!codec) {
+        return NULL;
+    }
+
     SLIST_FOREACH(helper, list, link) {
         if (helper->type == codec->type && helper->id == codec->id) {
             return helper;