Skip to content

Fix --block-size being ignored in ronin encrypt/decrypt#281

Open
gillisd wants to merge 1 commit into
ronin-rb:mainfrom
gillisd:fix/cipher-streaming
Open

Fix --block-size being ignored in ronin encrypt/decrypt#281
gillisd wants to merge 1 commit into
ronin-rb:mainfrom
gillisd:fix/cipher-streaming

Conversation

@gillisd
Copy link
Copy Markdown

@gillisd gillisd commented Apr 6, 2026

The --block-size option of ronin encrypt / ronin decrypt is silently ignored. The process_input method references @block_size, an instance variable that does not exist on CipherCommand. It evaluates to nil, causing cipher.stream to call io.read(nil) which reads the entire input into memory at once instead of streaming in chunks.

# --block-size has no effect; entire file is read into memory
$ ronin encrypt --password secret --block-size 4096 largefile.bin > encrypted.bin

This PR adds specs for Encrypt#process_input and fixes the reference to use options[:block_size], so the CLI flag actually takes effect.

process_input referenced @block_size which does not exist as an instance
variable on CipherCommand, so it evaluated to nil. This caused
cipher.stream to call io.read(nil) which reads the entire input into
memory at once instead of streaming in chunks.

Changed to options[:block_size] to read the actual CLI option value.

Also added specs for Encrypt#process_input.
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

Successfully merging this pull request may close these issues.

1 participant