]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't crash in wxHTML when parsing empty tables with empty width parameter.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 1 Nov 2012 17:15:12 +0000 (17:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 1 Nov 2012 17:15:12 +0000 (17:15 +0000)
Guard against accessing invalid string element.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/html/m_tables.cpp

index 7bca5a4c3feed94d941de7c45e252715053f6658..825329b2ca0fbb911b3ae849a20debb17bced7af 100644 (file)
@@ -288,7 +288,7 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
         {
             wxString wd = tag.GetParam(wxT("WIDTH"));
 
-            if (wd[wd.length()-1] == wxT('%'))
+            if (!wd.empty() && wd[wd.length()-1] == wxT('%'))
             {
                 if ( wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width) == 1 )
                 {
@@ -704,7 +704,7 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
                 {
                     wxString wd = tag.GetParam(wxT("WIDTH"));
 
-                    if (wd[wd.length()-1] == wxT('%'))
+                    if (!wd.empty() && wd[wd.length()-1] == wxT('%'))
                     {
                         int width = 0;
                         wxSscanf(wd.c_str(), wxT("%i%%"), &width);