Malformed ZIP64 extra metadata can panic AI Hub pulls
Describe the bug
The remote ZIP parser reads 64-bit values from a ZIP64 extra field without verifying that the advertised values are present. A central-directory entry can set its compressed and uncompressed sizes to 0xFFFFFFFF and provide only the four-byte tag/size header with a zero-length payload. read_u64 then indexes past the extra slice and panics instead of rejecting the archive.
To Reproduce
- Build a valid stored ZIP containing model.bin.
- In its central-directory entry, set compressed and uncompressed sizes to 0xFFFFFFFF.
- Add ZIP64 extra-field tag 0x0001 with declared size 0.
- Call fetch_central_directory through LocalFileTransport.
- Run rejects_truncated_zip64_extra_metadata.
Current main panics at remote_zip.rs:312 with index out of bounds: the len is 4 but the index is 4.
Expected behavior
Malformed or truncated ZIP64 metadata should return Error::Hub naming the entry and invalid extra field. Planning an AI Hub pull must never panic on untrusted archive bytes.
Screenshots
Not applicable; the failure is deterministic with an in-memory archive mutation and no network or device.
Desktop (please complete the following information):
- OS: Windows 11 ARM64
- Browser: N/A
- Version: upstream main 90df1dc2; Rust 1.98.0 GNU
Smartphone (please complete the following information):
- Device: N/A
- OS: N/A
- Browser: N/A
- Version: N/A
Additional context
The same parser handles remote AI Hub ZIP assets and local AI Hub .zip pulls, so malformed archive metadata can crash either planning path. No existing issue or PR covers truncated ZIP64 extra fields.
Source: qualcomm/GenieX