[asterisk-commits] alecdavis: branch 1.8 r387297 - /branches/1.8/channels/chan_dahdi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 2 01:51:55 CDT 2013
Author: alecdavis
Date: Thu May 2 01:51:53 2013
New Revision: 387297
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387297
Log:
chan_dahdi: fix lower bound check with -ve integer conversion from a float
Lower bound of a 16bit signed int is -32768 not -32767
(closes issue ASTERISK-21744)
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)
Modified:
branches/1.8/channels/chan_dahdi.c
Modified: branches/1.8/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_dahdi.c?view=diff&rev=387297&r1=387296&r2=387297
==============================================================================
--- branches/1.8/channels/chan_dahdi.c (original)
+++ branches/1.8/channels/chan_dahdi.c Thu May 2 01:51:53 2013
@@ -5015,9 +5015,12 @@
if (drc) {
k = drc_sample(k, drc);
}
- k = (float)k*linear_gain;
- if (k > 32767) k = 32767;
- if (k < -32767) k = -32767;
+ k = (float)k * linear_gain;
+ if (k > 32767) {
+ k = 32767;
+ } else if (k < -32768) {
+ k = -32768;
+ }
g->txgain[j] = AST_LIN2A(k);
} else {
g->txgain[j] = j;
@@ -5031,9 +5034,12 @@
if (drc) {
k = drc_sample(k, drc);
}
- k = (float)k*linear_gain;
- if (k > 32767) k = 32767;
- if (k < -32767) k = -32767;
+ k = (float)k * linear_gain;
+ if (k > 32767) {
+ k = 32767;
+ } else if (k < -32768) {
+ k = -32768;
+ }
g->txgain[j] = AST_LIN2MU(k);
} else {
@@ -5058,9 +5064,12 @@
if (drc) {
k = drc_sample(k, drc);
}
- k = (float)k*linear_gain;
- if (k > 32767) k = 32767;
- if (k < -32767) k = -32767;
+ k = (float)k * linear_gain;
+ if (k > 32767) {
+ k = 32767;
+ } else if (k < -32768) {
+ k = -32768;
+ }
g->rxgain[j] = AST_LIN2A(k);
} else {
g->rxgain[j] = j;
@@ -5074,9 +5083,12 @@
if (drc) {
k = drc_sample(k, drc);
}
- k = (float)k*linear_gain;
- if (k > 32767) k = 32767;
- if (k < -32767) k = -32767;
+ k = (float)k * linear_gain;
+ if (k > 32767) {
+ k = 32767;
+ } else if (k < -32768) {
+ k = -32768;
+ }
g->rxgain[j] = AST_LIN2MU(k);
} else {
g->rxgain[j] = j;
More information about the asterisk-commits
mailing list