<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7233">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Corey Farrell: Looks good to me, but someone else must approve
Sean Bright: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">audiohook.c: Fix freeing a frame and still using it.<br><br>Memory corruption happened to the media frame caches when an audio hook<br>freed a frame when it shouldn't. I think the freed frame was because a<br>jitter buffer interpolated a missing frame and the audio hook<br>unconditionally freed it.<br><br>* Made audiohook.c:audio_audiohook_write_list() not free an interpolated<br>frame if it is the same frame as what was passed into the routine.<br><br>* Made plc.c:normalise_history() use memmove() instead of memcpy() on a<br>memory block that could overlap. Found by valgrind investigating this<br>issue.<br><br>ASTERISK-27238<br>ASTERISK-27412<br><br>Change-Id: I548d86894281fc4529aefeb9f161f2131ecc6fde<br>---<br>M main/audiohook.c<br>M main/plc.c<br>2 files changed, 4 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/audiohook.c b/main/audiohook.c<br>index 2cba2de..04a379f 100644<br>--- a/main/audiohook.c<br>+++ b/main/audiohook.c<br>@@ -950,7 +950,9 @@<br> * rely on actual media being present to do things.<br> */<br> if (!middle_frame->data.ptr) {<br>- ast_frfree(middle_frame);<br>+ if (middle_frame != start_frame) {<br>+ ast_frfree(middle_frame);<br>+ }<br> return start_frame;<br> }<br> <br>diff --git a/main/plc.c b/main/plc.c<br>index b649357..739f727 100644<br>--- a/main/plc.c<br>+++ b/main/plc.c<br>@@ -96,7 +96,7 @@<br> if (s->buf_ptr == 0)<br> return;<br> memcpy(tmp, s->history, sizeof(int16_t)*s->buf_ptr);<br>- memcpy(s->history, s->history + s->buf_ptr, sizeof(int16_t) * (PLC_HISTORY_LEN - s->buf_ptr));<br>+ memmove(s->history, s->history + s->buf_ptr, sizeof(int16_t) * (PLC_HISTORY_LEN - s->buf_ptr));<br> memcpy(s->history + PLC_HISTORY_LEN - s->buf_ptr, tmp, sizeof(int16_t) * s->buf_ptr);<br> s->buf_ptr = 0;<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7233">change 7233</a>. To unsubscribe, 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/7233"/><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: I548d86894281fc4529aefeb9f161f2131ecc6fde </div>
<div style="display:none"> Gerrit-Change-Number: 7233 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>