Check indices validity better in wxGridStringTable.
Calling GetValue(-1, -1) could crash as the code naively only checked upper boundary (and didn't use unsigned which would have made the extra check unnecessary but it's too late for this now). Closes #11044. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1144,7 +1144,8 @@ wxGridStringTable::wxGridStringTable( int numRows, int numCols )
|
||||
|
||||
wxString wxGridStringTable::GetValue( int row, int col )
|
||||
{
|
||||
wxCHECK_MSG( (row < GetNumberRows()) && (col < GetNumberCols()),
|
||||
wxCHECK_MSG( (row >= 0 && row < GetNumberRows()) &&
|
||||
(col >= 0 && col < GetNumberCols()),
|
||||
wxEmptyString,
|
||||
wxT("invalid row or column index in wxGridStringTable") );
|
||||
|
||||
@@ -1153,7 +1154,8 @@ wxString wxGridStringTable::GetValue( int row, int col )
|
||||
|
||||
void wxGridStringTable::SetValue( int row, int col, const wxString& value )
|
||||
{
|
||||
wxCHECK_RET( (row < GetNumberRows()) && (col < GetNumberCols()),
|
||||
wxCHECK_RET( (row >= 0 && row < GetNumberRows()) &&
|
||||
(col >= 0 && col < GetNumberCols()),
|
||||
wxT("invalid row or column index in wxGridStringTable") );
|
||||
|
||||
m_data[row][col] = value;
|
||||
|
Reference in New Issue
Block a user