<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6922">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">codec.c: Defensively check the returned samples.<br><br>Earlier versions of the codec_opus samples_count callback can return<br>negative values on undecodable frames. This resulted in a divide by zero<br>exception.<br><br>* Added a defensive check in ast_codec_samples_count() for a "negative"<br>samples count return value. Log the event and set the count to zero.<br><br>ASTERISK-27194<br><br>Change-Id: Icf69350307ecbbc80a3d74de46af9bd80ea17819<br>---<br>M main/codec.c<br>1 file changed, 5 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/22/6922/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/codec.c b/main/codec.c<br>index 7797147..5b262f6 100644<br>--- a/main/codec.c<br>+++ b/main/codec.c<br>@@ -406,6 +406,11 @@<br> <br> if (codec->samples_count) {<br> samples = codec->samples_count(frame);<br>+ if ((int) samples < 0) {<br>+ ast_log(LOG_WARNING, "Codec %s returned invalid number of samples.\n",<br>+ ast_format_get_name(frame->subclass.format));<br>+ samples = 0;<br>+ }<br> } else {<br> ast_log(LOG_WARNING, "Unable to calculate samples for codec %s\n",<br> ast_format_get_name(frame->subclass.format));<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6922">change 6922</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/6922"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Icf69350307ecbbc80a3d74de46af9bd80ea17819 </div>
<div style="display:none"> Gerrit-Change-Number: 6922 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>