J-F-Liu / lopdf

A Rust library for PDF document manipulation.
MIT License
1.67k stars 176 forks source link

Panic `called Result::unwrap() on an Err value: Type` in `src/document.rs:446:13` #302

Closed qarmin closed 3 months ago

qarmin commented 3 months ago
thread 'main' panicked at /home/rafal/.cargo/git/checkouts/lopdf-0013854ec52a6141/c25cef3/src/document.rs:446:83:
called `Result::unwrap()` on an `Err` value: ObjectNotFound
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7120fdac7a6e55a5e4b606256042890b36067052/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/7120fdac7a6e55a5e4b606256042890b36067052/library/core/src/panicking.rs:74:14
   2: core::result::unwrap_failed
             at /rustc/7120fdac7a6e55a5e4b606256042890b36067052/library/core/src/result.rs:1679:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/7120fdac7a6e55a5e4b606256042890b36067052/library/core/src/result.rs:1102:23
   4: lopdf::document::Document::get_page_resources
             at /home/rafal/.cargo/git/checkouts/lopdf-0013854ec52a6141/c25cef3/src/document.rs:446:13
   5: lopdf::document::Document::get_page_fonts
             at /home/rafal/.cargo/git/checkouts/lopdf-0013854ec52a6141/c25cef3/src/document.rs:478:45
   6: lopdf::parser_aux::<impl lopdf::document::Document>::extract_text
             at /home/rafal/.cargo/git/checkouts/lopdf-0013854ec52a6141/c25cef3/src/parser_aux.rs:71:25
   7: lopdf::check_file
             at /home/rafal/Projekty/Rust/run_command_for_every_file/src/crates/lopdf/src/main.rs:41:29
   8: lopdf::main
             at /home/rafal/Projekty/Rust/run_command_for_every_file/src/crates/lopdf/src/main.rs:23:9
   9: core::ops::function::FnOnce::call_once
             at /rustc/7120fdac7a6e55a5e4b606256042890b36067052/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Aborted (core dumped)

cause this

thread 'main' panicked at /home/runner/.cargo/git/checkouts/lopdf-0013854ec52a6141/c25cef3/src/document.rs:446:83:
called `Result::unwrap()` on an `Err` value: Type
stack backtrace:
   0: rust_begin_unwind
             at /rustc/91376f416222a238227c84a848d168835ede2cc3/library/std/src/panicking.rs:662:5
   1: core::panicking::panic_fmt
             at /rustc/91376f416222a238227c84a848d168835ede2cc3/library/core/src/panicking.rs:74:14
   2: core::result::unwrap_failed
             at /rustc/91376f416222a238227c84a848d168835ede2cc3/library/core/src/result.rs:1679:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/91376f416222a238227c84a848d168835ede2cc3/library/core/src/result.rs:1102:23
   4: lopdf::document::Document::get_page_resources
             at /home/runner/.cargo/git/checkouts/lopdf-0013854ec52a6141/c25cef3/src/document.rs:446:13
   5: lopdf::document::Document::get_page_fonts
             at /home/runner/.cargo/git/checkouts/lopdf-0013854ec52a6141/c25cef3/src/document.rs:478:45
   6: lopdf::parser_aux::<impl lopdf::document::Document>::extract_text
             at /home/runner/.cargo/git/checkouts/lopdf-0013854ec52a6141/c25cef3/src/parser_aux.rs:71:25
   7: lopdf::check_file
             at ./src/crates/lopdf/src/main.rs:41:29
   8: lopdf::main
             at ./src/crates/lopdf/src/main.rs:23:9
   9: core::ops::function::FnOnce::call_once
             at /rustc/91376f416222a238227c84a848d168835ede2cc3/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

##### Automatic Fuzzer note, output status "None", output signal "Some(6)"

compressed.zip

Heinenen commented 3 months ago

Thanks for reporting this and all your other findings! :)