[QScintilla] QScintilla crash upon second word separator in a string

Jack Cosgrove jackcosgrove at gmail.com
Tue Mar 20 05:49:14 GMT 2012


I found the source of the crash and a workaround.

The crash occurs on line 683 of qsciapis.cpp. Apparently
prep->raw_apis.end() is returning an invalid value and the it iterator
becomes out of range. The change I made is hackish (lines with code for
api_index) but I do not fully understand how prep->raw_apis.end() may be
invalid so I took the easy way out. Hopefully someone else can provide a
more meaningful fix.

        int api_index = 0; //added
        while (api_index < prep->raw_apis.count() &&
(*it).startsWith(path)) //(it != prep->raw_apis.end() &&
(*it).startsWith(path)) <-- line 683
        {
            QString w = (*it).mid(ctstart);

            if (w != prev && enoughCommas(w, commas))
            {
                shifts << shift;
                cts << w;
                prev = w;
            }

            ++it;
            ++api_index; //added
        }


On Mon, 2012-03-19 at 21:35 -0400, Gedalia Pasternak wrote:

> is there an assertion being triggered by the parser? I think I had to
> change the default qscintilla warning level down a level because
> occasionally a close to fatal assertion gets triggered splitting up
> strings. (sorry it was a couple of years ago so I'm a bit fuzzy.
> 
> 
> -gedalia
> 
> 
> On Mon, Mar 19, 2012 at 9:29 PM, Jack Cosgrove
> <jackcosgrove at gmail.com> wrote:
> 
>         Is there any way I can get some help with this?
>         
>         
>         On Sat, 2012-03-17 at 12:58 -0500, Jack Cosgrove wrote:
>         > Hi,
>         >
>         > I am encountering crashes when I try to use autocomplete to
>         fill in
>         > function arguments using the Python lexer. For example,
>         given an API
>         > entry of "foo.bar(foo, bar)", I will always be prompted for
>         foo and bar,
>         > but if I accept the autocompletion for "bar" and then type
>         an opening
>         > parenthesis my app crashes.
>         >
>         > Attached is a small example demonstrating this behavior.
>         Type in "fo",
>         > accept the suggestion, then ".", accept "bar", then "(" to
>         replicate.
>         >
>         > However, if you type in "fo", accept, then ".bar(", then
>         delete the "(",
>         > you can then type "(" again and encounter the function
>         argument
>         > suggestion. After this happens the first time the
>         application never
>         > crashes, even if replicating the first procedure on a new
>         line.
>         >
>         > Thanks to all who reply for your help!
>         
>         
>         
>         
>         _______________________________________________
>         QScintilla mailing list
>         QScintilla at riverbankcomputing.com
>         http://www.riverbankcomputing.com/mailman/listinfo/qscintilla
> 
> 
> 
> 
> 
> 
> 
> -- 
> ---------------------------------------------------------------
> cel: 917.776.8346                 AIM: gedaliap
> http://www.gedalia.net
> ---------------------------------------------------------------
> Fight Entropy!!!  Fight Entropy!!!  Figth Etnropy! !
> iFgth Etnrop!y ! giFth tErno!py !  giFt htrEno!p y! --- Well maybe
> not...
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/qscintilla/attachments/20120320/8aee0bc1/attachment.html>


More information about the QScintilla mailing list