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

bug: reading edit list packets fails when skipping bytes to the end of the file #4

Open
mmalenic opened this issue Oct 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mmalenic
Copy link
Collaborator

When decrypting and reading edit list packets, the last edit list skip causes a panic if it goes to the end of the data stream. In this loop:

crypt4gh-rust/src/lib.rs

Lines 516 to 522 in 2d41a17

loop {
let n = decrypted.read(SEGMENT_SIZE)?;
//log::debug!("body_decrypt_parts()'s reading until the end index: {}", n);
if n == 0 {
break;
}
}
The code tries to read a segment even though there is no data remaining in the read_buffer. This later causes decrypt_block to panic because it gets passed a slice with no data:
let (nonce_slice, data) = ciphersegment.split_at(12);

@mmalenic mmalenic added the bug Something isn't working label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant