pdf-rs / pdf

Rust library to read, manipulate and write PDF files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assertion failed: !key.is_empty() && key.len() <= 256 when checking file

qarmin opened this issue · comments

fn check_file(file_path: &str) {
    match FileOptions::cached().open(&file_path) {
        Ok(file) => {
            for idx in 0..file.num_pages() {
                if let Ok(page) = file.get_page(idx) {
                    let _ = page.media_box();
                    let _ = page.crop_box();
                    let _ = page.resources();
                }
                let _ = file.get_root();
            }
        }
        Err(e) => println!("{}    -     {:?}", file_path, e),
    }
}
thread 'main' panicked at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/crypt.rs:37:9:
assertion failed: !key.is_empty() && key.len() <= 256
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fcaa6fdfbee1316184e7ad98c53241d52cd30a5f/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/fcaa6fdfbee1316184e7ad98c53241d52cd30a5f/library/core/src/panicking.rs:74:14
   2: core::panicking::panic
             at /rustc/fcaa6fdfbee1316184e7ad98c53241d52cd30a5f/library/core/src/panicking.rs:148:5
   3: pdf::crypt::Rc4::new
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/crypt.rs:37:9
   4: pdf::crypt::Rc4::encrypt
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/crypt.rs:56:23
   5: pdf::crypt::Decoder::from_password::compute_u_rev_3_4
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/crypt.rs:195:13
   6: pdf::crypt::Decoder::from_password::check_password_rev_3_4
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/crypt.rs:211:37
   7: pdf::crypt::Decoder::from_password::check_password_rc4
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/crypt.rs:218:17
   8: pdf::crypt::Decoder::from_password
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/crypt.rs:329:16
   9: pdf::file::Storage<B,OC,SC,L>::load_storage_and_trailer_password
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/file.rs:174:36
  10: pdf::file::File<B,OC,SC,L>::load_data
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/file.rs:606:23
  11: pdf::file::FileOptions<OC,SC,L>::load
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/file.rs:592:9
  12: pdf::file::FileOptions<OC,SC,L>::open
             at /home/runner/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/b0f40b6/pdf/src/file.rs:582:9
  13: pdf::check_file
             at ./src/crates/pdf/src/main.rs:26:11
  14: pdf::main
             at ./src/crates/pdf/src/main.rs:21:9
  15: core::ops::function::FnOnce::call_once
             at /rustc/fcaa6fdfbee1316184e7ad98c53241d52cd30a5f/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
timeout: the monitored command dumped core

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

compressed.zip