Re: Multiple selection causing application crash

Neil Hodgson <[email protected]> Tue, 14 Jan 2025 18:46:32 -0800 (PST)
Newsgroups gmane.comp.lib.scintilla.devel
Message-ID <[email protected]>
Jean:

It was a call to the command SCI_GETSELTEXT() that I did not suspect to 
occur in a piece of code executed every 500 ms to update a value in the 
app's status bar.
I could not tell why this command crashed when called with multiple 
selection. Could it be related to the buffer size? I can post code if you 
wish.


   A too-small buffer will overflow and potentially cause trouble. The size 
required should be calculated first by calling SCI_GETSELTEXT with a NULL 
argument, then a new buffer allocated of the correct size which is then 
used for getting the actual value. There may be a +1 that is needed for the 
NUL byte terminator - this was changed at some point but allocating too 
much is safer.

   Neil

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/76a496f1-2a23-4332-a87b-1acd6a2fafd4n%40googlegroups.com.