]> git.saurik.com Git - wxWidgets.git/commitdiff
check tables width parameter for invalid values
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 4 May 2008 09:36:33 +0000 (09:36 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 4 May 2008 09:36:33 +0000 (09:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53445 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/html/m_tables.cpp

index f50de26c79ec8175f00791be58360c1b040a519f..c5d63e602002617c15c584f880bf7b94904f0ba8 100644 (file)
@@ -282,14 +282,19 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
 
             if (wd[wd.length()-1] == wxT('%'))
             {
-                wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width);
-                m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
+                if ( wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width) == 1 )
+                {
+                    m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
+                }
             }
             else
             {
-                wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width);
-                m_ColsInfo[c].width = (int)(m_PixelScale * (double)m_ColsInfo[c].width);
-                m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
+                long width;
+                if ( wd.ToLong(&width) )
+                {
+                    m_ColsInfo[c].width = (int)(m_PixelScale * (double)width);
+                    m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
+                }
             }
         }
     }