alexcrichton / tar-rs

Tar file reading/writing for Rust
https://docs.rs/tar
Apache License 2.0
616 stars 178 forks source link

Can not handle very large UID/GID in PAX style tar #332

Closed adamqqqplay closed 11 months ago

adamqqqplay commented 1 year ago

Details

Current code cannot handle very large UID/GID in PAX tar (>=2097151, limit of USTAR tar), mainly due to not reading values from PaxExtensions.

Reproduce

I have written a reproduce case in: https://github.com/adamqqqplay/tar-rs/tree/pax-large-uid-gid

Steps

git clone https://github.com/adamqqqplay/tar-rs
cd tar-rs
git checkout pax-large-uid-gid
./examples/pax/pax_build_tar.sh

sudo su
cargo run --package tar --example pax_untar

Results

This code throws an error because very large UIDs/GIDs cannot be read from the PAX extension.

[INFO] test tar file: ./examples/pax/biguid_gnu.tar [INFO] uid and gid test success

[INFO] test tar file: ./examples/pax/biguid_pax.tar thread 'main' panicked at 'assertion failed: (left == right) left: 0, right: 4294967294', examples/pax_untar.rs:47:13