[asterisk-commits] alecdavis: branch 11 r387298 - in /branches/11: ./ channels/chan_dahdi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 2 01:54:06 CDT 2013
Author: alecdavis
Date: Thu May 2 01:54:05 2013
New Revision: 387298
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387298
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)
........
Merged revisions 387297 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/11/ (props changed)
branches/11/channels/chan_dahdi.c
Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/11/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_dahdi.c?view=diff&rev=387298&r1=387297&r2=387298
==============================================================================
--- branches/11/channels/chan_dahdi.c (original)
+++ branches/11/channels/chan_dahdi.c Thu May 2 01:54:05 2013
@@ -5127,9 +5127,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;
@@ -5143,9 +5146,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 {
@@ -5170,9 +5176,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;
@@ -5186,9 +5195,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