mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-01 11:02:53 +00:00
avoid operations on closed file handles in embedded languages
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12255 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1daa0746e3
commit
ea88aed04b
@ -1190,6 +1190,10 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session,
|
||||
switch_file_handle_t *fh = cb_state->extra;
|
||||
struct js_session *jss = cb_state->session_state;
|
||||
|
||||
if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if ((status = js_common_callback(session, input, itype, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
@ -332,6 +332,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh,
|
||||
switch_assert(fh != NULL);
|
||||
switch_assert(fh->file_interface != NULL);
|
||||
|
||||
if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (!fh->file_interface->file_seek) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@ -349,6 +353,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t
|
||||
switch_assert(fh != NULL);
|
||||
switch_assert(fh->file_interface != NULL);
|
||||
|
||||
if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (!fh->file_interface->file_set_string) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@ -361,6 +369,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t
|
||||
switch_assert(fh != NULL);
|
||||
switch_assert(fh->file_interface != NULL);
|
||||
|
||||
if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (!fh->file_interface->file_get_string) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
@ -1207,6 +1207,10 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
|
||||
}
|
||||
|
||||
if (fhp) {
|
||||
if (!switch_test_flag(fhp, SWITCH_FILE_OPEN)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (!strncasecmp(result, "speed", 5)) {
|
||||
char *p;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user