Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Base64: invalid trailing characters when last line ending is near trailer #196

Open
jethrogb opened this issue Jul 20, 2019 · 0 comments
Open

Comments

@jethrogb
Copy link

This

println!("{:?}", b"foob".to_base64(Config{line_length:Some(4), ..STANDARD}));
println!("{:?}", b"foob".to_base64(Config{line_length:Some(5), ..STANDARD}));
println!("{:?}", b"foob".to_base64(Config{line_length:Some(6), ..STANDARD}));
println!("{:?}", b"foob".to_base64(Config{line_length:Some(7), ..STANDARD}));
println!("{:?}", b"foob".to_base64(Config{line_length:Some(8), ..STANDARD}));

prints

"Zm9v\r\nYg=="
"Zm9vYg===="
"Zm9vYg===="
"Zm9vYg===="
"Zm9vYg=="

This is invalid for line lengths 5~7.

(I'm not expecting this to be fixed but I'm still filing the issue to create awareness)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant