CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 08/01/05 02:26:19
Modified files: . : ChangeLog server : URLAccessManager.cpp server/asobj : SharedObject.cpp server/vm : VM.cpp VM.h Log message: Don't assume the movie_root has an instance of originating movie when VM is initialized. Provide a VM::getSWFUrl() to reliably fetch url of originating movie, and use it from URLAccessManager and SharedObject. Fixes a race condition in the URLAccessManager. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5302&r2=1.5303 http://cvs.savannah.gnu.org/viewcvs/gnash/server/URLAccessManager.cpp?cvsroot=gnash&r1=1.22&r2=1.23 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SharedObject.cpp?cvsroot=gnash&r1=1.26&r2=1.27 http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.28&r2=1.29 http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.h?cvsroot=gnash&r1=1.23&r2=1.24 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5302 retrieving revision 1.5303 diff -u -b -r1.5302 -r1.5303 --- ChangeLog 5 Jan 2008 01:28:34 -0000 1.5302 +++ ChangeLog 5 Jan 2008 02:26:18 -0000 1.5303 @@ -1,3 +1,13 @@ +2008-01-05 Sandro Santilli <[EMAIL PROTECTED]> + + * server/vm/VM.{cpp,h}: add getSWFUrl() method to fetch + url of originating movie in a reliable way. + * server/URLAccessManager.cpp (local_check): don't assume + the movie_root always has an instance of originating if + the VM is initialized (fixes a race condition). + * server/asobj/SharedObject.cpp: use the new VM::getSWFUrl() method + to figure out domain for .sol files (simplifies the code). + 2008-01-04 Rob Savoye <[EMAIL PROTECTED]> * libamf/sol.cpp: Properly caluculate the filesize. Index: server/URLAccessManager.cpp =================================================================== RCS file: /sources/gnash/gnash/server/URLAccessManager.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -b -r1.22 -r1.23 --- server/URLAccessManager.cpp 5 Jan 2008 00:08:47 -0000 1.22 +++ server/URLAccessManager.cpp 5 Jan 2008 02:26:19 -0000 1.23 @@ -224,9 +224,7 @@ // Don't allow local access if starting movie is a network resource. if ( VM::isInitialized() ) { - sprite_instance* startingMovie = VM::get().getRoot().getRootMovie(); - assert(startingMovie); // or VM would not be initialized (currently) - const URL& baseUrl = startingMovie->get_movie_definition()->get_url(); // get_base_url(); + URL baseUrl(VM::get().getSWFUrl()); if ( baseUrl.protocol() != "file" ) { log_security("Load of file %s forbidden" Index: server/asobj/SharedObject.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/SharedObject.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -b -r1.26 -r1.27 --- server/asobj/SharedObject.cpp 1 Jan 2008 10:45:59 -0000 1.26 +++ server/asobj/SharedObject.cpp 5 Jan 2008 02:26:19 -0000 1.27 @@ -281,10 +281,7 @@ // by the 'base' attribute of OBJECT or EMBED tags trough // -P base=xxx // - movie_root& mroot = obj->getVM().getRoot(); - sprite_instance* origMovie = mroot.getRootMovie(); - movie_definition* origMovieDef = origMovie->get_movie_definition(); - const string origURL = origMovieDef->get_url(); + const string& origURL = obj->getVM().getSWFUrl(); URL url(origURL); // log_debug(_("BASE URL=%s (%s)"), url.str().c_str(), url.hostname().c_str()); Index: server/vm/VM.cpp =================================================================== RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -b -r1.28 -r1.29 --- server/vm/VM.cpp 12 Dec 2007 18:19:27 -0000 1.28 +++ server/vm/VM.cpp 5 Jan 2008 02:26:19 -0000 1.29 @@ -16,7 +16,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -/* $Id: VM.cpp,v 1.28 2007/12/12 18:19:27 bwy Exp $ */ +/* $Id: VM.cpp,v 1.29 2008/01/05 02:26:19 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -85,12 +85,14 @@ : _root_movie(new movie_root()), _swfversion(topmovie.get_version()), + _swfurl(topmovie.get_url()), _start_time(tu_timer::get_ticks()), mClassHierarchy(0), mMachine(0), _clock(clock) { _clock.restart(); + assert(!_swfurl.empty()); } VM::~VM() @@ -116,6 +118,12 @@ return _swfversion; } +const std::string& +VM::getSWFUrl() const +{ + return _swfurl; +} + VM::RNG& VM::randomNumberGenerator() const { Index: server/vm/VM.h =================================================================== RCS file: /sources/gnash/gnash/server/vm/VM.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- server/vm/VM.h 12 Dec 2007 18:19:28 -0000 1.23 +++ server/vm/VM.h 5 Jan 2008 02:26:19 -0000 1.24 @@ -123,6 +123,9 @@ /// Target SWF version int _swfversion; + /// Originating URL + std::string _swfurl; + /// Time when the VM get started boost::uint64_t _start_time; @@ -193,6 +196,12 @@ /// int getSWFVersion() const; + /// Get URL of the SWF movie used to initialize this VM + // + /// This information will be used for security checks + /// + const std::string& getSWFUrl() const; + /// Get the number of milliseconds since VM was started unsigned long int getTime() const; _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit