Commit 042eb7e8 authored by Michael Van Canneyt's avatar Michael Van Canneyt
Browse files

* Small safety precaution

parent e27ea76b
Pipeline #454282773 passed with stages
in 18 minutes and 33 seconds
......@@ -414,7 +414,7 @@ procedure TStream.ReadBuffer(var Buffer; Count: NativeInt);
if r>High(Longint) then r:=High(Longint);
r:=Read(PByte(@Buffer)[t],r);
inc(t,r);
until (t=Count) or (r<=0);
until (t>=Count) or (r<=0);
if (t<Count) then
raise EReadError.Create(SReadError);
end;
......@@ -591,7 +591,7 @@ procedure TStream.WriteBuffer(const Buffer; Count: NativeInt);
if w>High(Longint) then w:=High(Longint);
w:=Write(PByte(@Buffer)[t],w);
inc(t,w);
until (t=count) or (w<=0);
until (t>=count) or (w<=0);
if (t<Count) then
raise EWriteError.Create(SWriteError);
end;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment