Skip to content

Commit 668ea19

Browse files
committed
der: pem reader rejects zero lengths reads
Since base64ct 1.7.0 ([RustCrypto#1387]), it now rejects zero lengths reads. This happens to trigger with an sha256WithRSAEncryption AlgorithmIdentifier where the parameters are null.
1 parent acf95f8 commit 668ea19

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

der/src/reader/pem.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ impl<'i> Reader<'i> for PemReader<'i> {
8787
}
8888

8989
fn read_into<'o>(&mut self, buf: &'o mut [u8]) -> crate::Result<&'o [u8]> {
90+
if buf.is_empty() {
91+
return Ok(buf);
92+
}
93+
9094
let new_position = (self.position + buf.len())?;
9195
if new_position > self.input_len {
9296
return Err(ErrorKind::Incomplete {

0 commit comments

Comments
 (0)