<p style="white-space: pre-wrap; word-wrap: break-word;">Looking at the code some more I think that all control frames (PING, PONG, CLOSE) need an early exit in the code to ensure we don't continue into the defragmentation code. </p><ul><li>the PING opcode handling doesn't do this, it only exits if we fail to send a PONG response. If we successfully send our response, the code will happily stuff the PING's payload into session->payload, possibly corrupting a data frame.</li></ul><ul><li>there is no explicit PONG handling, so it will happily corrupt data frames too.</li></ul><ul><li>the CLOSE opcode handling I added does exit.</li></ul><p style="white-space: pre-wrap; word-wrap: break-word;">I think control frame handling should also either not return a payload at all (since *payload will be pointing at a temporary buffer) or use something like a separate session->control_payload.</p><p><a href="https://gerrit.asterisk.org/10861">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10861">change 10861</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/10861"/><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: comment </div>
<div style="display:none"> Gerrit-Change-Id: Icb1b60205fc77ee970ddc91d1f545671781344cf </div>
<div style="display:none"> Gerrit-Change-Number: 10861 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Jeremy LainĂ© <jeremy.laine@m4x.org> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Jeremy LainĂ© <jeremy.laine@m4x.org> </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>
<div style="display:none"> Gerrit-Comment-Date: Tue, 15 Jan 2019 19:49:03 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-HasLabels: No </div>