<p>Valentin Vidić has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10893">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">channel.c: Fix segfault with Monitor(wav,file,i)<br><br>If the Monitor is started with the i option the read_stream will be<br>NULL. One code path in channel.c checks if write_stream is set but than<br>uses read_stream instead causing a segfault.<br><br>ASTERISK-28249<br><br>Change-Id: I395b0975e4d38916cfbf65b4e91785450992307b<br>---<br>M main/channel.c<br>1 file 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/93/10893/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/channel.c b/main/channel.c</span><br><span>index 74d7986..07b1521 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -5442,7 +5442,7 @@</span><br><span> if (jump >= 0) {</span><br><span> jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)),</span><br><span> ast_format_get_sample_rate(f->subclass.format),</span><br><span style="color: hsl(0, 100%, 40%);">- ast_format_get_sample_rate(ast_channel_monitor(chan)->read_stream->fmt->format));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_format_get_sample_rate(ast_channel_monitor(chan)->write_stream->fmt->format));</span><br><span> if (ast_seekstream(ast_channel_monitor(chan)->write_stream, jump, SEEK_FORCECUR) == -1) {</span><br><span> ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");</span><br><span> }</span><br><span>@@ -5453,7 +5453,7 @@</span><br><span> #else</span><br><span> int jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)),</span><br><span> ast_format_get_sample_rate(f->subclass.format),</span><br><span style="color: hsl(0, 100%, 40%);">- ast_format_get_sample_rate(ast_channel_monitor(chan)->read_stream->fmt->format));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_format_get_sample_rate(ast_channel_monitor(chan)->write_stream->fmt->format));</span><br><span> if (jump - MONITOR_DELAY >= 0) {</span><br><span> if (ast_seekstream(ast_channel_monitor(chan)->write_stream, jump - cur->samples, SEEK_FORCECUR) == -1) {</span><br><span> ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10893">change 10893</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/10893"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I395b0975e4d38916cfbf65b4e91785450992307b </div>
<div style="display:none"> Gerrit-Change-Number: 10893 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Valentin Vidić <vvidic@valentin-vidic.from.hr> </div>