From 175fea401a912f33d5899a6746420a1a73592b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 4 May 2008 09:37:00 +0000 Subject: [PATCH] check tables width parameter for invalid values git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/m_tables.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/html/m_tables.cpp b/src/html/m_tables.cpp index cc82145ae7..3b896c0851 100644 --- a/src/html/m_tables.cpp +++ b/src/html/m_tables.cpp @@ -281,14 +281,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; + } } } }