<p>Valentin Vidić has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10894">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: I18aac9ec6265da950c9e351101a15c2c04bba6ee<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/94/10894/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 c5981d2..8b6b895 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -5194,7 +5194,7 @@</span><br><span> #ifndef MONITOR_CONSTANT_DELAY</span><br><span>                              int jump = ast_channel_insmpl(chan) - ast_channel_outsmpl(chan) - 4 * cur->samples;</span><br><span>                               if (jump >= 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                     jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)), ast_format_rate(&f->subclass.format), ast_format_rate(&ast_channel_monitor(chan)->read_stream->fmt->format));</span><br><span style="color: hsl(120, 100%, 40%);">+                                    jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)), ast_format_rate(&f->subclass.format), ast_format_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>@@ -5203,7 +5203,7 @@</span><br><span>                                    ast_channel_outsmpl_set(chan, ast_channel_outsmpl(chan) + cur->samples);</span><br><span>                          }</span><br><span> #else</span><br><span style="color: hsl(0, 100%, 40%);">-                              int jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)), ast_format_rate(f->subclass.codec), ast_format_rate(ast_channel_monitor(chan)->read_stream->fmt->format));</span><br><span style="color: hsl(120, 100%, 40%);">+                           int jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)), ast_format_rate(f->subclass.codec), ast_format_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/10894">change 10894</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/10894"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 11 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I18aac9ec6265da950c9e351101a15c2c04bba6ee </div>
<div style="display:none"> Gerrit-Change-Number: 10894 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Valentin Vidić <vvidic@valentin-vidic.from.hr> </div>