#1 2022-07-04 06:59:21

missionhq
Member
From: Australia
Registered: 2019-06-11
Posts: 33

TZipWrite Exception in AddDeflated on Delphi 11

I am calling TZipWrite.AddDeflated and passing a filename and it's giving and Assert exception in SynZip.TSynZipCompressor.Seek

It seems the base TStream.CopyFrom routine has changed from D10.4 to D11.0 and now calls TStream.GetSize as part of it's CopyFrom code and now calls  TSynZipCompressor.Seek(0, soFromEnd) to determin the stream size
I've changed the TSynZipCompressor code like this...

function TSynZipCompressor.Seek(Offset: Integer; Origin: Word): Longint;
begin
  if not FInitialized then
    result := 0 else
  if (Offset = 0) and (Origin in [soFromCurrent, soFromEnd]) then // <== changed from  (Origin = soFromCurrent) then // for TStream.Position
    result := FStrm.total_in else begin
    result := 0;
    assert((Offset = 0) and (Origin = soFromBeginning) and (FStrm.total_in = 0));
  end;
end;

Arnaud - is this correct. Should it work?

Offline

#2 2022-07-04 08:10:27

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: TZipWrite Exception in AddDeflated on Delphi 11

Should be fixed in https://github.com/synopse/mORMot2/commit/4ed9344c
With the proper 64-bit Seek() method.

Thanks for the report.

Offline

Board footer

Powered by FluxBB