]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix dereference of null pointer in video_bridge_thread() when codec b is not...
authorAndrey Volk <andywolk@gmail.com>
Mon, 20 Apr 2020 17:04:46 +0000 (21:04 +0400)
committerAndrey Volk <andywolk@gmail.com>
Wed, 6 May 2020 23:12:51 +0000 (03:12 +0400)
src/switch_ivr_bridge.c

index cc38f1f28b877afe6584e7f14b7df13ee3014ebc..d90ae88f89e18feed479392f239a240cbf64b7e8 100644 (file)
@@ -175,9 +175,6 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
 
        while (switch_channel_up_nosig(channel) && switch_channel_up_nosig(b_channel) && vh->up == 1) {
                if (switch_channel_media_up(channel)) {
-                       switch_codec_t *a_codec = switch_core_session_get_video_read_codec(vh->session_a);
-                       switch_codec_t *b_codec = switch_core_session_get_video_write_codec(vh->session_b);
-                       
                        if (switch_core_session_transcoding(vh->session_a, vh->session_b, SWITCH_MEDIA_TYPE_VIDEO)) {
                                pass_val = 1;
                        } else {
@@ -195,11 +192,14 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
                        }
 
                        if (!switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-                               switch_assert(a_codec);
-                               switch_assert(b_codec);
+                               switch_codec_implementation_t session_a_codec_implementation;
+                               switch_codec_implementation_t session_b_codec_implementation;
+
+                               switch_core_session_get_video_read_impl(vh->session_a, &session_a_codec_implementation);
+                               switch_core_session_get_video_write_impl(vh->session_b, &session_b_codec_implementation);
 
                                if (switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ)) {
-                                       if (a_codec->implementation->impl_id == b_codec->implementation->impl_id && !switch_channel_test_flag(b_channel, CF_VIDEO_DECODED_READ)) {
+                                       if (session_a_codec_implementation.impl_id == session_b_codec_implementation.impl_id && !switch_channel_test_flag(b_channel, CF_VIDEO_DECODED_READ)) {
                                                if (set_decoded_read) {
                                                        switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ);
                                                        set_decoded_read = 0;
@@ -207,7 +207,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
                                                }
                                        }
                                } else {
-                                       if (a_codec->implementation->impl_id != b_codec->implementation->impl_id ||
+                                       if (session_a_codec_implementation.impl_id != session_b_codec_implementation.impl_id ||
                                                switch_channel_test_flag(b_channel, CF_VIDEO_DECODED_READ)) {
                                                switch_channel_set_flag_recursive(channel, CF_VIDEO_DECODED_READ);
                                                set_decoded_read = 1;