Menu

#4 Crash Bug in ScintillaControl.GetLine()

open
nobody
None
5
2005-09-07
2005-09-07
No

The original function sets up a buffer for line, but
requests line + 1 from the control, thereby returning an
incorrect result, and an exception if the buffer was too
small. The fixed function is:

unsafe public string GetLine( int line )
{
int sz = (int)SPerform(2153,(uint)line ,0);
byte[] buffer = new byte[sz+1];
fixed (byte* b = buffer)
SPerform( 2153 ,(uint)line , (uint)b );
return System.Text.UTF8Encoding.UTF8.GetString
(buffer,0,sz);
}

Discussion


Log in to post a comment.