pdf-rs/pdf

thread 'main' panicked at 'Unknown part primitive in dictionary: Number(1.0)'

tokatoka opened this issue · 1 comments

toka@toka:~/repro$ ./target/release/repro crash-e55.pdf 
thread 'main' panicked at 'Unknown part primitive in dictionary: Number(1.0)', /home/toka/.cargo/git/checkouts/pdf-3ef1c528a9b91eec/a6e2abc/pdf/src/encoding.rs:55:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is the main.rs to reproduce

fn harness(file: &String) {
    if let Ok(file) = pdf::file::FileOptions::cached().open(file) {
        for idx in 0..file.num_pages() {
            let _ = file.get_page(idx);
        }
    }
}

fn main() {
    let args: Vec<String> = std::env::args().collect();

    let _ = harness(&args[1]);
}

and this is the crashing input
crash-e55.pdf

pdf/pdf/src/encoding.rs

Lines 54 to 56 in a6e2abc

}
_ => panic!("Unknown part primitive in dictionary: {:?}", part),
}

This panic is triggered

s3bk commented

That is ... why would they use a real number for indexing something.