Due to line let mut output = vec![0; (self.input.as_ref().len() / 8 + 1) * 6]; in into_vec it only allocates 30 bytes (encoding is 11111111111111111111111111111111 which has length of 32).
Simple unit test:
let data = vec![0; 32];
let s = b58::encode(&data).to_string();
let result = b58::decode(&s).into_vec().unwrap(); // crash
assert_eq!(result, data);
Due to line
let mut output = vec![0; (self.input.as_ref().len() / 8 + 1) * 6];
ininto_vec
it only allocates 30 bytes (encoding is11111111111111111111111111111111
which has length of 32).Simple unit test: