Fix invalid memory read in wxMSW wxTextCtrl::GetLineText()
Don't read before the start of the buffer when getting the text of an empty line, this was (correctly) flagged as heap error by address sanitizer.
This commit is contained in:
@@ -1928,7 +1928,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
|
|||||||
|
|
||||||
// remove the '\n' at the end, if any (this is how this function is
|
// remove the '\n' at the end, if any (this is how this function is
|
||||||
// supposed to work according to the docs)
|
// supposed to work according to the docs)
|
||||||
if ( buf[len - 1] == wxT('\n') )
|
if ( len && buf[len - 1] == wxT('\n') )
|
||||||
{
|
{
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user