Skip to content

Bug in ZMUnzipOpr.pas #2

@raelb

Description

@raelb

Hi Edwin,
From my analysis, there appears to be a bug in ZMUnzipOpr.pas.

function TZMUnzipOpr.UnzipAStream

Needs to include a call to ZReader.File_Close (at end of method)

  if Result >= 0 then
  begin
    ZReader.Guage.NewItem(ZName, ZRec.CompressedSize);
    try
      Result := FExtractor.Decompress;
      Body.TraceFmt('Inflate returns: %s', [Body.Errors.ErrorStr(Result)],
        {_LINE_}1315, __UNIT__);
      if Result >= 0 then
        Result := CheckCRC(FExtractor.CRC, ZRec.CRC32, ZRec.FileName);
      Err := AbsErr(Result);
      if (DestStream <> nil) and ((Err = ZE_BadCRC) or (Err = ZE_EntryCancelled))
      then
        DestStream.Size := 0;
    finally
      ZReader.Guage.EndItem;

      ZReader.File_Close; // -> Added
    end;
  end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions