gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r9905: Make sure the parser consumes


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9905: Make sure the parser consumes all input, even on error. Fixes bug #24429.
Date: Thu, 02 Oct 2008 18:12:12 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9905
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Thu 2008-10-02 18:12:12 +0200
message:
  Make sure the parser consumes all input, even on error. Fixes bug #24429.
modified:
  libcore/SWFStream.cpp
  libcore/SWFStream.h
  libcore/parser/SWFMovieDefinition.cpp
=== modified file 'libcore/SWFStream.cpp'
--- a/libcore/SWFStream.cpp     2008-09-04 11:25:31 +0000
+++ b/libcore/SWFStream.cpp     2008-10-02 16:12:12 +0000
@@ -617,6 +617,20 @@
     m_unused_bits = 0;
 }
 
+void
+SWFStream::consumeInput()
+{
+       // IOChannel::go_to_end is documented
+       // to possibly throw an exception (!)
+       try {
+               m_input->go_to_end();
+       } catch (IOException& ex) {
+               log_error("SWFStream::consumeInput: underlying stream couldn't 
go_to_end: %s",
+                       ex.what());
+               // eh.. and now ?!
+       }
+}
+
 } // end namespace gnash
 
     

=== modified file 'libcore/SWFStream.h'
--- a/libcore/SWFStream.h       2008-08-18 23:53:04 +0000
+++ b/libcore/SWFStream.h       2008-10-02 16:12:12 +0000
@@ -393,6 +393,24 @@
 #endif
        }
 
+       /// Consume any pending input
+       //
+       /// This method is useful to force full consumption
+       /// of the SWFStream's underlying IOChannel for the 
+       /// cases in which it is a pipe and a writer would
+       /// hang on it unless someone is reading.
+       ///
+       /// This method will NOT be called automatically
+       /// on SWFStream destruction as in the current 
+       /// design SWFStream does NOT own the underlying 
+       /// IOChannel. TODO: rethink about ownership.
+       ///
+       /// NOTE: the stream position will be updated by
+       ///       this call, so that ::tell will basically
+       ///       return the full input size.
+       ///
+       void consumeInput();
+
 private:
 
        IOChannel*      m_input;

=== modified file 'libcore/parser/SWFMovieDefinition.cpp'
--- a/libcore/parser/SWFMovieDefinition.cpp     2008-09-04 15:32:42 +0000
+++ b/libcore/parser/SWFMovieDefinition.cpp     2008-10-02 16:12:12 +0000
@@ -707,6 +707,10 @@
                log_error(_("Parsing exception: %s"), e.what());
        }
 
+       // Make sure we won't leave any pending writers
+       // on any eventual fd-based IOChannel.
+       str.consumeInput();
+
        size_t floaded = get_loading_frame();
        if ( ! m_playlist[floaded].empty() )
        {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]