From 88504b1be93afb6be89b1c2948453a4581d3d0eb Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Sun, 11 Jan 2015 09:04:35 +1100 Subject: LexHex: add a default case for handling faulty states to all lexers If the state variable is set to a state not used in this lexer, an endless loop would occur because Forward() is never invoked then. --- lexers/LexHex.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lexers/LexHex.cxx b/lexers/LexHex.cxx index c0ffa0cbe..f3a31d5a2 100644 --- a/lexers/LexHex.cxx +++ b/lexers/LexHex.cxx @@ -700,6 +700,11 @@ static void ColouriseSrecDoc(unsigned int startPos, int length, int initStyle, W sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; + + default: + // prevent endless loop in faulty state + sc.SetState(SCE_HEX_DEFAULT); + break; } } sc.Complete(); @@ -811,6 +816,11 @@ static void ColouriseIHexDoc(unsigned int startPos, int length, int initStyle, W sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; + + default: + // prevent endless loop in faulty state + sc.SetState(SCE_HEX_DEFAULT); + break; } } sc.Complete(); @@ -956,6 +966,11 @@ static void ColouriseTEHexDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; + + default: + // prevent endless loop in faulty state + sc.SetState(SCE_HEX_DEFAULT); + break; } } sc.Complete(); -- cgit v1.2.3