Skip to content

Commit fbd258e

Browse files
committed
fix(binascii): a2b_base64() raises on non padded input
1 parent ee4efd4 commit fbd258e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

stdlib/src/binascii.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ mod decl {
104104
} else {
105105
b
106106
};
107+
if b.len() % 4 != 0 {
108+
return Err(base64::DecodeError::InvalidLength)
109+
}
107110
base64::decode(b)
108111
})
109112
.map_err(|err| vm.new_value_error(format!("error decoding base64: {}", err)))

0 commit comments

Comments
 (0)