Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
qarmin opened this issue Jul 15, 2024 · 0 comments
Open

Comments

@qarmin
Copy link

qarmin commented Jul 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant