Skip to content

Commit 39a8919

Browse files
committed
fix: reject Shelley addresses with invalid high bit in from_bytes_key
Signed-off-by: William Hankins <[email protected]>
1 parent 10c2c09 commit 39a8919

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

common/src/address.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ impl ShelleyAddress {
353353
}
354354

355355
let header = data[0];
356+
357+
if header & 0x80 != 0 {
358+
return Err(anyhow!("invalid header: high bit set"));
359+
}
360+
356361
let network = match header & 0x0F {
357362
0 => NetworkId::Testnet,
358363
1 => NetworkId::Mainnet,

0 commit comments

Comments
 (0)