xpath.pp: Fixed runtime range and overflow checks, at least those which could be detected with existing test suite.

git-svn-id: trunk@13827 -
This commit is contained in:
sergei 2009-10-09 17:47:53 +00:00
parent 6a0755e897
commit 3f5ce0d228

View File

@ -2472,11 +2472,12 @@ var
begin
Head := 1;
L := Length(s);
while (Head <= L) and IsXmlWhiteSpace(s[Head]) do
Inc(Head);
while Head <= L do
begin
while (Head <= L) and IsXmlWhiteSpace(s[Head]) do
Inc(Head);
Tail := Head;
while (Tail <= L) and not IsXmlWhiteSpace(s[Tail]) do
Inc(Tail);
@ -2486,8 +2487,6 @@ var
ns.Add(Element);
Head := Tail;
while IsXmlWhiteSpace(s[Head]) do
Inc(Head);
end;
end;
@ -2686,9 +2685,10 @@ begin
n2 := floor(0.5 + e2);
end;
i := Max(n1, 1);
n2 := n2 + n1 - i;
if empty then
n2 := -1;
n2 := -1
else if n2 < MaxInt then
n2 := n2 + (n1 - i);
Result := TXPathStringVariable.Create(Copy(s, i, n2));
end;