mdsteele / rust-cab

Rust library for encoding/decoding Windows cabinet (.cab) files
MIT License
15 stars 8 forks source link

Panic when open cab archive #15

Closed ikrivosheev closed 2 years ago

ikrivosheev commented 2 years ago

Hello! I get panic when try open cab archive: thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/ikrivosheev/.local/share/cargo/registry/src/rust-mirror.ptsecurity.ru-8e2111e0e0190772/cab-0.3.0/src/internal/cabinet.rs:601:15

Dropbox link to the file: https://www.dropbox.com/s/uyad749bo9k8pgi/data1.cab?dl=0

mdsteele commented 2 years ago

Thanks for the report. It looks like that CAB file contains two folders, the second of which contains only an empty file, and thus no data blocks. The FolderReader::seek() method was not handling that case well, crashing when trying to seek to the beginning of a folder when the list of data blocks is empty. Should be simple enough to fix.

ikrivosheev commented 2 years ago

@mdsteele thank you! Can you make small fix release?

mdsteele commented 2 years ago

Sure, I've now published this as v0.4.1.

ikrivosheev commented 2 years ago

@mdsteele thanks a lot!