[Freeswitch-svn] [commit] r8514 - freeswitch/trunk/src
Freeswitch SVN
stkn at freeswitch.org
Wed May 21 18:26:31 EDT 2008
Author: stkn
Date: Wed May 21 18:26:30 2008
New Revision: 8514
Modified:
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_loadable_module.c
Log:
Add safety check for codec implementations with bytes_per_frames being larger than the recommended buffer size (Klocwork #1039)
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Wed May 21 18:26:30 2008
@@ -487,6 +487,7 @@
if (switch_test_flag(read_frame, SFF_CNG)) {
sendlen = read_codec->implementation->bytes_per_frame;
+ switch_assert(sendlen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
memset(decoded, 255, sendlen);
sendbuf = decoded;
tstatus = SWITCH_STATUS_SUCCESS;
Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/trunk/src/switch_loadable_module.c Wed May 21 18:26:30 2008
@@ -154,13 +154,18 @@
for (impl = ptr->implementations; impl; impl = impl->next) {
if (!impl->iananame) {
load_interface = 0;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name, key);
+ break;
+ }
+ if (impl->bytes_per_frame > SWITCH_RECOMMENDED_BUFFER_SIZE) {
+ load_interface = 0;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "Failed to load codec interface %s from %s due to bytes per frame exceeding buffer size.\n", ptr->interface_name, key);
break;
}
}
- if (!load_interface) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
- "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name, key);
- } else {
+ if (load_interface) {
for (impl = ptr->implementations; impl; impl = impl->next) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
"Adding Codec '%s' (%s) %dhz %dms\n",
More information about the Freeswitch-svn
mailing list