guzba / zippy

Pure Nim implementation of deflate, zlib, gzip and zip.
MIT License
248 stars 29 forks source link

Zippy throws RangeDefect when parsing file permissions on 32-bit systems. #85

Closed nervecenter closed 3 weeks ago

nervecenter commented 1 month ago

When compiled for Arm 32-bit and run on a Raspberry Pi Zero, zippy throws the following RangeDefect:

Error: unhandled exception: value out of range: 2176188416 notin -2147483648 .. 2147483647 [RangeDefect]

This is because the proc parseFilePermissions() is set up to read the platform-flexible signed int, and externalFileAttr: uint32 is converted to an int when parsing file permissions. It should instead be used as the uint32 it already is. We can fix this by changing the following two lines:

These changes negate the issue on the Raspberry Pi Zero, and hopefully should do the same on other 32-bit systems.

guzba commented 3 weeks ago

Thanks for reporting the issue and debugging information. This should be fixed in release 0.10.16.