paszlib: File Attributes in TZipFileEntry must be unsigned.
Original Reporter info from Mantis: JuhaManninen @JuhaManninen
-
Reporter name: Juha Manninen
Original Reporter info from Mantis: JuhaManninen @JuhaManninen
- Reporter name: Juha Manninen
Description:
TZipper.BuildZipDirectory has code:
{$IFDEF UNIX}
External_Attributes := Entries[ACount].Attributes shl 16;
{$ELSE}
External_Attributes := Entries[ACount].Attributes;
{$ENDIF}
Assignment causes an overflow because the Attributes property is LongInt.
It should be LongWord.
In my case the value was $81A4. Shifting 16 bits left made it negative.
The attached patch fixes the problem.
Steps to reproduce:
This came up when testing our new online package manager:
http://forum.lazarus.freepascal.org/index.php/topic,34297
I believe it can be reproduced by Zipping any directory on Linux.
Mantis conversion info:
- Mantis ID: 30800
- OS: Linux
- OS Build: Manjaro
- Platform: Intel x86-64
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 35466 (#ef26fbd8)