[Freeswitch-svn] [commit] r12255 - in freeswitch/trunk/src: . mod/languages/mod_spidermonkey

FreeSWITCH SVN anthm at freeswitch.org
Mon Feb 23 11:52:29 PST 2009


Author: anthm
Date: Mon Feb 23 13:52:29 2009
New Revision: 12255

Log:
avoid operations on closed file handles in embedded languages

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/trunk/src/switch_core_file.c
   freeswitch/trunk/src/switch_cpp.cpp

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Mon Feb 23 13:52:29 2009
@@ -1190,6 +1190,10 @@
 	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;
 	}

Modified: freeswitch/trunk/src/switch_core_file.c
==============================================================================
--- freeswitch/trunk/src/switch_core_file.c	(original)
+++ freeswitch/trunk/src/switch_core_file.c	Mon Feb 23 13:52:29 2009
@@ -332,6 +332,10 @@
 	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_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_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;
 	}

Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp	(original)
+++ freeswitch/trunk/src/switch_cpp.cpp	Mon Feb 23 13:52:29 2009
@@ -1207,6 +1207,10 @@
     }
 
 	if (fhp) {
+		if (!switch_test_flag(fhp, SWITCH_FILE_OPEN)) {
+			return SWITCH_STATUS_FALSE;
+		}
+
 		if (!strncasecmp(result, "speed", 5)) {
 			char *p;
 		



More information about the Freeswitch-svn mailing list