git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29225
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
off_t wxStringInputStream::OnSysSeek(off_t ofs, wxSeekMode mode)
{
+ const size_t ofsMax = m_str.length()*sizeof(wxChar);
+
switch ( mode )
{
case wxFromStart:
break;
case wxFromEnd:
- ofs += m_str.length()*sizeof(wxChar);
+ ofs += ofsMax;
break;
case wxFromCurrent:
return wxInvalidOffset;
}
+ if ( ofs < 0 || wx_static_cast(size_t, ofs) >= ofsMax )
+ return wxInvalidOffset;
+
m_pos = wx_static_cast(size_t, ofs);
return ofs;