<p>Valentin Vidić has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10895">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: I24e1b3debffe2a7ff18f345d5a1da1f51ecd67a1<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/95/10895/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 8f27822..d767aba 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -5260,7 +5260,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>@@ -5271,7 +5271,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/10895">change 10895</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/10895"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I24e1b3debffe2a7ff18f345d5a1da1f51ecd67a1 </div>
<div style="display:none"> Gerrit-Change-Number: 10895 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Valentin Vidić <vvidic@valentin-vidic.from.hr> </div>