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

Panic in crypt.rs when slicing into key #126

Closed
5225225 opened this issue Jan 9, 2022 · 4 comments
Closed

Panic in crypt.rs when slicing into key #126

5225225 opened this issue Jan 9, 2022 · 4 comments

Comments

@5225225
Copy link
Contributor

5225225 commented Jan 9, 2022

thread '<unnamed>' panicked at 'range end index 32 out of range for slice of length 25', /home/jess/src/pdf/pdf/src/crypt.rs:572:17

crash.pdf

pdf/pdf/src/crypt.rs

Lines 569 to 575 in dc3016b

// b)
let mut key = [0; 16 + 5 + 4];
let n = self.key_size;
key[..n].copy_from_slice(self.key());
key[n..n + 3].copy_from_slice(&id.to_le_bytes()[..3]);
key[n + 3..n + 5].copy_from_slice(&gen.to_le_bytes()[..2]);
key[n + 5..n + 9].copy_from_slice(b"sAlT");

@s3bk
Copy link
Contributor

s3bk commented Jan 11, 2022

Is that supposed to decrypt correctly?

@s3bk
Copy link
Contributor

s3bk commented Jan 11, 2022

I see a preview in dolphin, but okular wants a password..

@5225225
Copy link
Contributor Author

5225225 commented Jan 11, 2022

It was fuzzed, I just threw in all the files from the tests folder. So it's probably too corrupted to have a valid password.

Still, shouldn't panic.

@s3bk
Copy link
Contributor

s3bk commented Jan 11, 2022

okay, then it should be fixed.

@s3bk s3bk closed this as completed Feb 20, 2022
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

2 participants