gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10562: Prevent abort on apparently


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10562: Prevent abort on apparently poorly-formed embedded MP3.
Date: Sun, 08 Feb 2009 10:48:19 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10562
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sun 2009-02-08 10:48:19 +0100
message:
  Prevent abort on apparently poorly-formed embedded MP3.
modified:
  libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
  libsound/EmbedSoundInst.cpp
    ------------------------------------------------------------
    revno: 10560.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Sun 2009-02-08 10:42:01 +0100
    message:
      Drop apparently wrong assertion that the decode will always consume what's
      passed to it if there's no error.
    modified:
      libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
      libsound/EmbedSoundInst.cpp
=== modified file 'libmedia/ffmpeg/AudioDecoderFfmpeg.cpp'
--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp    2008-11-27 13:05:09 +0000
+++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp    2009-02-08 09:42:01 +0000
@@ -409,12 +409,16 @@
 #endif
 
                // all good so far, keep going..
-               // (we might do this immediately, as we'll override 
decodedBytes on error anyway)
+               // (we might do this immediately, as we'll override decodedBytes
+        // on error anyway)
                decodedBytes += consumed;
 
         if ( ! framesize )
         {
-            assert(decodedBytes == inputSize);
+            // If nothing is consumed, this will fail. It can happen if a
+            // block is passed to the decoder when nothing can be 
+            // parsed from the block. This is probably a malformed SWF.
+            //assert(decodedBytes == inputSize);
 
             // NOTE: If this happens the caller sent us
             //       a block of data which is not composed
@@ -476,15 +480,20 @@
                     "capacity is only %d bytes",
                     retBufSize+(unsigned)outSize, retCapacity);
 #endif 
-                       boost::uint8_t* tmp = retBuf;
-                       retCapacity = 
std::max(retBufSize+static_cast<size_t>(outSize), retCapacity*2);
+
+            boost::uint8_t* tmp = retBuf;
+                       retCapacity = 
std::max(retBufSize+static_cast<size_t>(outSize),
+                    retCapacity * 2);
+
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-                       log_debug("    reallocating it to hold up to %d bytes", 
retCapacity);
+                       log_debug("    reallocating it to hold up to %d bytes",
+                    retCapacity);
 #endif // GNASH_DEBUG_AUDIO_DECODING
-                       retBuf = new boost::uint8_t[retCapacity];
+
+            retBuf = new boost::uint8_t[retCapacity];
                        if ( retBufSize ) std::copy(tmp, tmp+retBufSize, 
retBuf);
                        delete [] tmp;
-               }
+        }
                std::copy(outBuf.get(), outBuf.get()+outSize, 
retBuf+retBufSize);
                retBufSize += static_cast<unsigned int>(outSize);
        }

=== modified file 'libsound/EmbedSoundInst.cpp'
--- a/libsound/EmbedSoundInst.cpp       2008-11-13 14:09:19 +0000
+++ b/libsound/EmbedSoundInst.cpp       2009-02-08 09:42:01 +0000
@@ -77,7 +77,7 @@
 void
 EmbedSoundInst::createDecoder(media::MediaHandler& mediaHandler)
 {
-    media::SoundInfo& si = *(_soundDef.soundinfo);
+    media::SoundInfo& si = *_soundDef.soundinfo;
 
     media::AudioInfo info(
         (int)si.getFormat(), // codeci


reply via email to

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