UDL lexer: fix potential infinite loop
Fixed a condition in a loop which is always true (unsigned >= 0) and can potentially turn the loop infinite. And removed a check after the loop which now is also always false. Close #10597pull/10600/head
parent
4d57f5071f
commit
49c3e5d553
|
@ -785,6 +785,8 @@ static inline void StringToVector(char * original, vector<string> & tokenVector,
|
|||
static inline void ReColoringCheck(Sci_PositionU & startPos, int & nestedLevel, int & initStyle, int & openIndex,
|
||||
int & isCommentLine, bool & isInComment, Accessor & styler, vector<nestedInfo> & lastNestedGroup,
|
||||
vector<nestedInfo> & nestedVector, /* vector<int> & foldVector, */ int & continueCommentBlock)
|
||||
{
|
||||
if (startPos > 0)
|
||||
{
|
||||
// re-coloring always starts at line beginning !!
|
||||
|
||||
|
@ -795,11 +797,9 @@ static inline void ReColoringCheck(Sci_PositionU & startPos, int & nestedLevel,
|
|||
|| initStyle == SCE_USER_STYLE_FOLDER_IN_CODE2 )
|
||||
{
|
||||
// we are in middle of multi-part keyword that contains newline characters, go back until current style ends
|
||||
while (startPos >= 0 && styler.StyleAt(--startPos) == initStyle);
|
||||
while (startPos > 0 && styler.StyleAt(--startPos) == initStyle);
|
||||
}
|
||||
}
|
||||
|
||||
if (static_cast<int>(startPos) < 0)
|
||||
startPos = 0;
|
||||
|
||||
if (startPos > 0)
|
||||
{
|
||||
|
@ -808,8 +808,6 @@ static inline void ReColoringCheck(Sci_PositionU & startPos, int & nestedLevel,
|
|||
do
|
||||
{
|
||||
ch = styler.SafeGetCharAt(--startPos);
|
||||
if (startPos == -1)
|
||||
startPos = 0;
|
||||
}
|
||||
while(ch != '\r' && ch != '\n' && startPos > 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue