aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Heidelberg <markus.heidelberg@web.de>2015-01-11 09:04:35 +1100
committerMarkus Heidelberg <markus.heidelberg@web.de>2015-01-11 09:04:35 +1100
commit88504b1be93afb6be89b1c2948453a4581d3d0eb (patch)
treedea35e2516cd81337f0118698a40b56b6d761e51
parent683c68c04540c42b0b22de78da9c046b98ad50e2 (diff)
downloadscintilla-mirror-88504b1be93afb6be89b1c2948453a4581d3d0eb.tar.gz
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.
-rw-r--r--lexers/LexHex.cxx15
1 files changed, 15 insertions, 0 deletions
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();