Revision: 2130
          http://synfig.svn.sourceforge.net/synfig/?rev=2130&view=rev
Author:   dooglus
Date:     2008-10-26 12:15:50 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Fix 2195749: "Crash when try to open a sif with canvas size to be 0,0".  Check 
the width and height when loading a canvas.  Prohibit and size less than one.

Modified Paths:
--------------
    synfig-core/trunk/src/synfig/loadcanvas.cpp

Modified: synfig-core/trunk/src/synfig/loadcanvas.cpp
===================================================================
--- synfig-core/trunk/src/synfig/loadcanvas.cpp 2008-10-21 21:27:51 UTC (rev 
2129)
+++ synfig-core/trunk/src/synfig/loadcanvas.cpp 2008-10-26 12:15:50 UTC (rev 
2130)
@@ -1884,10 +1884,20 @@
                canvas->set_version(parent->get_version());
 
        if(element->get_attribute("width"))
-               
canvas->rend_desc().set_w(atoi(element->get_attribute("width")->get_value().c_str()));
+       {
+               int width = 
atoi(element->get_attribute("width")->get_value().c_str());
+               if (width < -1)
+                       fatal_error(element, _("Canvas with width or height 
less than one is not allowed"));
+               canvas->rend_desc().set_w(width);
+       }
 
        if(element->get_attribute("height"))
-               
canvas->rend_desc().set_h(atoi(element->get_attribute("height")->get_value().c_str()));
+       {
+               int height = 
atoi(element->get_attribute("height")->get_value().c_str());
+               if (height < -1)
+                       fatal_error(element, _("Canvas with width or height 
less than one is not allowed"));
+               canvas->rend_desc().set_h(height);
+       }
 
        if(element->get_attribute("xres"))
                
canvas->rend_desc().set_x_res(atof(element->get_attribute("xres")->get_value().c_str()));


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to