diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 44efb18ca0..dbd94f8f24 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -487,6 +487,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, 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; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index d592a35da6..1a2c2fbd61 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -154,13 +154,18 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable 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",