From: Sangchul Lee Date: Mon, 19 Aug 2024 02:08:52 +0000 (+0900) Subject: webrtc_data_channel: Fix use-after-free issue X-Git-Tag: accepted/tizen/7.0/unified/20240827.163857~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e78f64ea221bd7f9d30ccd20cd23d884f8938d8;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_data_channel: Fix use-after-free issue (cherry-picked from tizen branch) [Version] 0.3.305 [Issue Type] ASAN defect Change-Id: Idae9729c00520ca6aa55655fb795c0c9175ed6c0 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index d1d151d5..55aaa404 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.3.304 +Version: 0.3.305 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_data_channel.c b/src/webrtc_data_channel.c index ba9e19db..288fbd2a 100644 --- a/src/webrtc_data_channel.c +++ b/src/webrtc_data_channel.c @@ -252,9 +252,9 @@ int _destroy_data_channel(webrtc_data_channel_s *channel) RET_VAL_IF(channel == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "channel is NULL"); RET_VAL_IF(channel->from_remote, WEBRTC_ERROR_INVALID_PARAMETER, "do not destroy a data channel obtained from _on_data_channel_cb()"); - g_hash_table_remove(channel->webrtc->data_channels, channel); + LOG_INFO("data channel[%p, object:%p] will be destroyed", channel, channel->channel); - LOG_INFO("data channel[%p, object:%p] is destroyed", channel, channel->channel); + g_hash_table_remove(channel->webrtc->data_channels, channel); return WEBRTC_ERROR_NONE; }