From 09290da51ee6ea8bc8510482fb3d8fe2755ff258 Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 8 Jun 2021 08:52:50 +0000 Subject: [PATCH] * use local buffer for seek mantis #38930 patch by Hendi. git-svn-id: trunk@49490 - --- packages/fcl-db/src/base/db.pas | 2 +- packages/paszlib/src/zstream.pp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/fcl-db/src/base/db.pas b/packages/fcl-db/src/base/db.pas index 8e6e0229c5..f2bfcafd01 100644 --- a/packages/fcl-db/src/base/db.pas +++ b/packages/fcl-db/src/base/db.pas @@ -2554,7 +2554,7 @@ end; procedure TIndexDef.SetDescFields(const AValue: string); begin if FDescFields=AValue then exit; - if AValue <> '' then FOptions:=FOptions + [ixDescending]; + if AValue <> '' then FOptions[A:=FOptions + [ixDescending]; FDescFields:=AValue; end; diff --git a/packages/paszlib/src/zstream.pp b/packages/paszlib/src/zstream.pp index 900d98a77d..7760c0a799 100644 --- a/packages/paszlib/src/zstream.pp +++ b/packages/paszlib/src/zstream.pp @@ -325,6 +325,7 @@ end; function Tdecompressionstream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; var c,off: int64; + buf: array[0..8191] of Byte; begin off:=Offset; @@ -344,9 +345,9 @@ begin while off>0 do begin c:=off; - if c>bufsize then - c:=bufsize; - if read(Fbuffer^,c)<>c then + if c>SizeOf(buf) then + c:=SizeOf(buf); + if read(buf,c)<>c then raise Edecompressionerror.create(Sseek_failed); dec(off,c); end;