Hi,

If you type %% at the EOF while using the batch file lexer the app dies.
Patch attached.

-- 
Snow
--- LexOthers.cxx.old   2006-02-13 13:29:30.000000000 +0000
+++ LexOthers.cxx       2006-08-30 20:49:14.000000000 +0100
@@ -125,7 +125,7 @@
                        styler.ColourTo(startLine + offset + 1, 
SCE_BAT_IDENTIFIER);
                        offset += 2;
                        // Check for External Command / Program
-                       if (!isspacechar(lineBuffer[offset])) {
+                       if (offset < lengthLine && 
!isspacechar(lineBuffer[offset])) {
                                cmdLoc = offset;
                        }
                // Check for Environment Variable (%x...%)
@@ -136,7 +136,7 @@
                        styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER);
                        offset++;
                        // Check for External Command / Program
-                       if (!isspacechar(lineBuffer[offset])) {
+                       if (offset < lengthLine && 
!isspacechar(lineBuffer[offset])) {
                                cmdLoc = offset;
                        }
                }
@@ -371,6 +371,7 @@
                                offset -= (wbl - wbo);
                        // Check for Local Variable (%%a)
                        } else if (
+                               wbl > 2 &&
                                (wordBuffer[1] == '%') &&
                                (wordBuffer[2] != '%') &&
                                (!IsBOperator(wordBuffer[2])) &&
@@ -473,6 +474,7 @@
                }
        }
        if (linePos > 0) {      // Last line does not have ending characters
+               lineBuffer[linePos] = '\0';
                ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + 
length - 1,
                                   keywordlists, styler);
        }
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to