mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 06:49:16 +02:00
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:
parent
6a0755e897
commit
3f5ce0d228
@ -2472,11 +2472,12 @@ var
|
|||||||
begin
|
begin
|
||||||
Head := 1;
|
Head := 1;
|
||||||
L := Length(s);
|
L := Length(s);
|
||||||
while (Head <= L) and IsXmlWhiteSpace(s[Head]) do
|
|
||||||
Inc(Head);
|
|
||||||
|
|
||||||
while Head <= L do
|
while Head <= L do
|
||||||
begin
|
begin
|
||||||
|
while (Head <= L) and IsXmlWhiteSpace(s[Head]) do
|
||||||
|
Inc(Head);
|
||||||
|
|
||||||
Tail := Head;
|
Tail := Head;
|
||||||
while (Tail <= L) and not IsXmlWhiteSpace(s[Tail]) do
|
while (Tail <= L) and not IsXmlWhiteSpace(s[Tail]) do
|
||||||
Inc(Tail);
|
Inc(Tail);
|
||||||
@ -2486,8 +2487,6 @@ var
|
|||||||
ns.Add(Element);
|
ns.Add(Element);
|
||||||
|
|
||||||
Head := Tail;
|
Head := Tail;
|
||||||
while IsXmlWhiteSpace(s[Head]) do
|
|
||||||
Inc(Head);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2686,9 +2685,10 @@ begin
|
|||||||
n2 := floor(0.5 + e2);
|
n2 := floor(0.5 + e2);
|
||||||
end;
|
end;
|
||||||
i := Max(n1, 1);
|
i := Max(n1, 1);
|
||||||
n2 := n2 + n1 - i;
|
|
||||||
if empty then
|
if empty then
|
||||||
n2 := -1;
|
n2 := -1
|
||||||
|
else if n2 < MaxInt then
|
||||||
|
n2 := n2 + (n1 - i);
|
||||||
Result := TXPathStringVariable.Create(Copy(s, i, n2));
|
Result := TXPathStringVariable.Create(Copy(s, i, n2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user