maidsafe / self_encryption

file self encryptor
Other
118 stars 70 forks source link

get_pad_key_and_iv panics if a chunk is missing #338

Open davidpbrown opened 2 years ago

davidpbrown commented 2 years ago

Unclear if function get_pad_key_and_iv is used beyond just the basic_encryptor.

Following through the simple example

cargo build --example basic_encryptor --release

Which works well normally.

This panics, in the case that a block is missing:

src/lib.rs:247:21 from fn get_pad_key_and_iv

let src_hash = &chunk_hashes[chunk_index];

So, done just by moving a block out of the way.

$ ./basic_encryptor -d /tmp/chunk_store_test/secret_key "/tmp/chunk_store_test/hello" thread '' panicked at 'index out of bounds: the len is 2 but the index is 2', src/lib.rs:247:21