* handle streams with bit 3 better, closes #40369

This commit is contained in:
marcoonthegit 2023-08-05 21:26:49 +02:00
parent dcb91d0b52
commit 4561d8982f

View File

@ -2329,6 +2329,15 @@ Begin
With LocalHdr do
begin
Item.FBitFlags:=Bit_Flag;
// If bit 3 is set in the BitFlags, file size and CRC should be read from
// the DataDescriptor record. For simplicity, however, we copy them from
// the same fields of the zipfile entry.
if Item.FBitFlags and $0008 <> 0 then
begin
Uncompressed_Size := Item.Size;
Compressed_Size := Item.CompressedSize;
CRC32 := Item.CRC32;
end;
SetLength(S,Filename_Length);
FZipStream.ReadBuffer(S[1],Filename_Length);
if Bit_Flag and EFS_LANGUAGE_ENCODING_FLAG <> 0 then
@ -2597,6 +2606,7 @@ Begin
// Header position will be corrected later with zip64 version, if needed..
NewNode.HdrPos := Local_Header_Offset;
NewNode.FBitFlags:=Bit_Flag;
NewNode.FCompressMethod := Compress_Method;
SetLength(S,Filename_Length);
FZipStream.ReadBuffer(S[1],Filename_Length);
if Bit_Flag and EFS_LANGUAGE_ENCODING_FLAG <> 0 then