fix, UB in HL due to white attribs not always defined after skipping white chars

This commit is contained in:
Basile Burg 2015-10-30 04:44:25 +01:00
parent 28f9e86b84
commit 5fb7e718ae
1 changed files with 9 additions and 5 deletions

View File

@ -240,7 +240,8 @@ const
cmpRes: array[boolean] of integer = (-1, 1);
begin
result := inherited Compare(Range);
if result <> 0 then exit;
assert(Range <> nil);
{if result <> 0 then exit;
//
if Range is TSynD2SynRange then
begin
@ -252,7 +253,7 @@ begin
exit(cmpRes[src_t.tokenStringBracketsCount > tokenStringBracketsCount]);
if src_t.namedRegionCount <> namedRegionCount then
exit(cmpRes[src_t.namedRegionCount > namedRegionCount]);
end;
end; }
end;
procedure TSynD2SynRange.Clear;
@ -522,10 +523,13 @@ begin
// spaces
if (isWhite(reader^)) then
begin
while(isWhite(reader^)) do
readerNext;
fTokKind := tkBlank;
exit;
while(true) do
begin
if isWhite(reader^) then
readerNext;
exit;
end;
end;
// line comment / region beg-end