<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13708">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_stasis_playback: Prevent media_index from going out of bounds<br><br>Incrementing stasis_app_playback.media_index directly in our playback<br>loop means that when we reach the end of our playlist the index into<br>the vector will be outside of the bounds of the vector.<br><br>Instead use a temporary variable and only assign when we're sure that<br>we are in bounds.<br><br>ASTERISK-28713 #close<br>Reported by: Sébastien Duthil<br><br>Change-Id: Ib53f7f156097e0607eb5871d9d78d246ed274928<br>---<br>M res/res_stasis_playback.c<br>1 file changed, 3 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c</span><br><span>index 4a75382..7665d5f 100644</span><br><span>--- a/res/res_stasis_playback.c</span><br><span>+++ b/res/res_stasis_playback.c</span><br><span>@@ -287,6 +287,7 @@</span><br><span> {</span><br><span> int res;</span><br><span> long offsetms;</span><br><span style="color: hsl(120, 100%, 40%);">+ size_t index;</span><br><span> </span><br><span> /* Even though these local variables look fairly pointless, they avoid</span><br><span> * having a bunch of NULL's passed directly into</span><br><span>@@ -305,7 +306,8 @@</span><br><span> </span><br><span> offsetms = playback->offsetms;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- for (; playback->media_index < AST_VECTOR_SIZE(&playback->medias); playback->media_index++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ for (index = 0; index < AST_VECTOR_SIZE(&playback->medias); index++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ playback->media_index = index;</span><br><span> </span><br><span> /* Set the current media to play */</span><br><span> ast_string_field_set(playback, media, AST_VECTOR_GET(&playback->medias, playback->media_index));</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13708">change 13708</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/+/13708"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: Ib53f7f156097e0607eb5871d9d78d246ed274928 </div>
<div style="display:none"> Gerrit-Change-Number: 13708 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>