gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. b4a97cdc4096f0aea334


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. b4a97cdc4096f0aea334234216608b552b635a32
Date: Wed, 20 Oct 2010 12:23:32 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  b4a97cdc4096f0aea334234216608b552b635a32 (commit)
       via  cf87ba129b515193dc4700612906c5e64a8582d7 (commit)
       via  2f7d2a0b1204c167fe7065f68e982649e52a5599 (commit)
      from  8bb73f65e8d85f6d640f74e256d646c66fbd6a13 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=b4a97cdc4096f0aea334234216608b552b635a32


commit b4a97cdc4096f0aea334234216608b552b635a32
Merge: cf87ba1 8bb73f6
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 14:23:22 2010 +0200

    Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=cf87ba129b515193dc4700612906c5e64a8582d7


commit cf87ba129b515193dc4700612906c5e64a8582d7
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 13:48:00 2010 +0200

    Handle exception when allocating an image.

diff --git a/libcore/swf/tag_loaders.cpp b/libcore/swf/tag_loaders.cpp
index 84c3397..da823ef 100644
--- a/libcore/swf/tag_loaders.cpp
+++ b/libcore/swf/tag_loaders.cpp
@@ -577,12 +577,10 @@ define_bits_lossless_2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
 
     // No need to parse any further if it already exists, as we aren't going
     // to add it.
-    if (m.getBitmap(id))
-    {
+    if (m.getBitmap(id)) {
         IF_VERBOSE_MALFORMED_SWF(
             log_swferror(_("DEFINEBITSLOSSLESS: Duplicate id (%d) "
-                           "for bitmap DisplayObject - discarding it"),
-                id);
+                           "for bitmap DisplayObject - discarding it"), id);
         );
     }
 
@@ -595,20 +593,29 @@ define_bits_lossless_2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     std::auto_ptr<image::GnashImage> image;
     bool alpha = false;
 
-    switch (tag)
-    {
-        case SWF::DEFINELOSSLESS:
-            image.reset(new image::ImageRGB(width, height));
-            channels = 3;
-            break;
-        case SWF::DEFINELOSSLESS2:
-            image.reset(new image::ImageRGBA(width, height));
-            channels = 4;
-            alpha = true;
-            break;
-        default:
-            // This is already asserted.
-            std::abort();
+    try {
+
+        switch (tag) {
+            case SWF::DEFINELOSSLESS:
+                image.reset(new image::ImageRGB(width, height));
+                channels = 3;
+                break;
+            case SWF::DEFINELOSSLESS2:
+                image.reset(new image::ImageRGBA(width, height));
+                channels = 4;
+                alpha = true;
+                break;
+            default:
+                // This is already asserted.
+                std::abort();
+        }
+    }
+    catch (const std::bad_alloc&) {
+        // Image constructors will throw bad_alloc if they don't like the
+        // size. This isn't usually from operator new.
+        log_error(_("Will not allocate %1%x%2% image in DefineBitsLossless "
+                "tag"), width, height);
+        return;
     }
 
     unsigned short bytes_per_pixel;

http://git.savannah.gnu.org/cgit//commit/?id=2f7d2a0b1204c167fe7065f68e982649e52a5599


commit 2f7d2a0b1204c167fe7065f68e982649e52a5599
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 13:47:32 2010 +0200

    Don't call finishImage in dtor because it can throw. Handle
    case where scanline isn't read.

diff --git a/libbase/GnashImageJpeg.cpp b/libbase/GnashImageJpeg.cpp
index b89534b..a736277 100644
--- a/libbase/GnashImageJpeg.cpp
+++ b/libbase/GnashImageJpeg.cpp
@@ -232,8 +232,6 @@ JpegInput::JpegInput(boost::shared_ptr<IOChannel> in)
 
 JpegInput::~JpegInput()
 {
-    finishImage();
-
     rw_source_IOChannel* src =
         reinterpret_cast<rw_source_IOChannel*>(m_cinfo.src);
 
@@ -405,8 +403,14 @@ JpegInput::readScanline(unsigned char* rgb_data)
     assert(_compressorOpened);
     assert(m_cinfo.output_scanline < m_cinfo.output_height);
 
-    const int lines_read = jpeg_read_scanlines(&m_cinfo, &rgb_data, 1);
-    assert(lines_read == 1);
+    // C and its unsigned variables...
+    const int toRead = 1;
+    const int lines_read = jpeg_read_scanlines(&m_cinfo, &rgb_data, toRead);
+
+    // This happens in real cases.
+    if (lines_read != toRead) {
+        throw ParserException("Could not read JPEG scanline");
+    }
 
     // Expand grayscale to RGB
     if (m_cinfo.out_color_space == JCS_GRAYSCALE) {

-----------------------------------------------------------------------

Summary of changes:
 libbase/GnashImageJpeg.cpp  |   12 ++++++++----
 libcore/swf/tag_loaders.cpp |   43 +++++++++++++++++++++++++------------------
 2 files changed, 33 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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