Panic on parsing archive
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.5k
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
Parsing this archive file seems to cause a panic:
thread 'main' panicked at 'no entry found for key', src/libcore/option.rs:1166:5
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:47
3: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:36
4: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:200
5: std::panicking::default_hook
at src/libstd/panicking.rs:214
6: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:477
7: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:384
8: rust_begin_unwind
at src/libstd/panicking.rs:311
9: core::panicking::panic_fmt
at src/libcore/panicking.rs:85
10: core::option::expect_failed
at src/libcore/option.rs:1166
11: core::option::Option<T>::expect
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/option.rs:345
12: <alloc::collections::btree::map::BTreeMap<K,V> as core::ops::index::Index<&Q>>::index
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/liballoc/collections/btree/map.rs:1835
13: goblin::archive::Archive::parse
at goblin/src/archive/mod.rs:467
14: goblin::Object::parse
at goblin/src/lib.rs:312
15: strand_match::main
at src/main.rs:25
16: std::rt::lang_start::{{closure}}
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
17: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:49
18: std::panicking::try::do_call
at src/libstd/panicking.rs:296
19: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:80
20: std::panicking::try
at src/libstd/panicking.rs:275
21: std::panic::catch_unwind
at src/libstd/panic.rs:394
22: std::rt::lang_start_internal
at src/libstd/rt.rs:48
23: std::rt::lang_start
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
24: main
25: __libc_start_main
26: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Source:
use std::fs::File;
use std::path::Path;
use std::io::Read;
use goblin::Object;
fn main() {
let mut f = File::open(Path::new("os.a")).unwrap();
let mut buf = Vec::new();
f.read_to_end(&mut buf);
Object::parse(&buf);
}
ar seems to extract this archive just fine as well.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the panic with the linked os.zip archive and the Rust example, then inspect goblin/src/archive/mod.rs:467 and the call path through goblin/src/lib.rs:312. Confirm how the archive differs from one that ar extracts successfully. Done means parsing this archive no longer panics and regression coverage demonstrates the corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- reverse-engineering
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100