提交 088b842c authored 作者: Stefan Knoblich's avatar Stefan Knoblich

Add safety check for codec implementations with bytes_per_frames being larger…

Add safety check for codec implementations with bytes_per_frames being larger than the recommended buffer size (Klocwork #1039)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8514 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 0bdd7007
......@@ -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;
......
......@@ -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",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论