<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15743">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_channel_write_frame: Check for NULL channel<br><br>There is a possibility, when bridge_channel_write_frame() is<br>called, that the bridge_channel->chan will be NULL. The first<br>thing bridge_channel_write_frame() does though is call<br>ast_channel_is_multistream() which had no check for a NULL<br>channel and therefore caused a segfault. Since it's still<br>possible for bridge_channel_write_frame() to write the frame to<br>the other channels in the bridge, we don't want to bail before we<br>call ast_channel_is_multistream() but we can just skip the<br>multi-channel stuff. So...<br><br>bridge_channel_write_frame() only calls ast_channel_is_multistream()<br>if bridge_channel->chan is not NULL.<br><br>As a safety measure, ast_channel_is_multistream() now returns<br>false if the supplied channel is NULL.<br><br>ASTERISK-29379<br>Reported-by: Vyrva Igor<br>Reported-by: Ross Beer<br><br>Change-Id: Idfe62dbea8c69813ecfd58e113a6620dc42352ce<br>---<br>M main/bridge_channel.c<br>M main/channel_internal_api.c<br>2 files changed, 2 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/43/15743/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/bridge_channel.c b/main/bridge_channel.c</span><br><span>index 3c5e87b..dc73cfe 100644</span><br><span>--- a/main/bridge_channel.c</span><br><span>+++ b/main/bridge_channel.c</span><br><span>@@ -658,7 +658,7 @@</span><br><span> ast_bridge_channel_lock_bridge(bridge_channel);</span><br><span> </span><br><span> /* Map the frame to the bridge. */</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_channel_is_multistream(bridge_channel->chan)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (bridge_channel->chan && ast_channel_is_multistream(bridge_channel->chan)) {</span><br><span> unmapped_stream_num = frame->stream_num;</span><br><span> switch (frame->frametype) {</span><br><span> case AST_FRAME_VOICE:</span><br><span>diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c</span><br><span>index fb62da5..a84534a 100644</span><br><span>--- a/main/channel_internal_api.c</span><br><span>+++ b/main/channel_internal_api.c</span><br><span>@@ -1642,7 +1642,7 @@</span><br><span> </span><br><span> int ast_channel_is_multistream(struct ast_channel *chan)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- return (chan->tech && chan->tech->read_stream && chan->tech->write_stream);</span><br><span style="color: hsl(120, 100%, 40%);">+ return (chan && chan->tech && chan->tech->read_stream && chan->tech->write_stream);</span><br><span> }</span><br><span> </span><br><span> struct ast_channel_snapshot *ast_channel_snapshot(const struct ast_channel *chan)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15743">change 15743</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15743"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Idfe62dbea8c69813ecfd58e113a6620dc42352ce </div>
<div style="display:none"> Gerrit-Change-Number: 15743 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>