<p>Joshua C. Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10896">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, but someone else must approve
Joshua C. Colp: Looks good to me, but someone else must approve; Approved for Submit
Sean Bright: Looks good to me, approved
</div><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: I1bae9126537be54895c7fea2d08dd9488d8cc525<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;"><span>diff --git a/main/channel.c b/main/channel.c</span><br><span>index 4fb226d..bad1480 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -5225,7 +5225,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>@@ -5236,7 +5236,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/10896">change 10896</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/10896"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I1bae9126537be54895c7fea2d08dd9488d8cc525 </div>
<div style="display:none"> Gerrit-Change-Number: 10896 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Valentin Vidić <vvidic@valentin-vidic.from.hr> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>