Skip to content

Commit

Permalink
rpc: fix possible panics in optimize_filters (#29146)
Browse files Browse the repository at this point in the history
(cherry picked from commit ccd96e2)
  • Loading branch information
fanatid authored and mergify[bot] committed Dec 15, 2022
1 parent f864d4b commit d57ae0c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2165,10 +2165,14 @@ fn optimize_filters(filters: &mut [RpcFilterType]) {
match &compare.bytes {
#[allow(deprecated)]
Binary(bytes) | Base58(bytes) => {
compare.bytes = Bytes(bs58::decode(bytes).into_vec().unwrap());
if let Ok(bytes) = bs58::decode(bytes).into_vec() {
compare.bytes = Bytes(bytes);
}
}
Base64(bytes) => {
compare.bytes = Bytes(base64::decode(bytes).unwrap());
if let Ok(bytes) = base64::decode(bytes) {
compare.bytes = Bytes(bytes);
}
}
_ => {}
}
Expand Down

0 comments on commit d57ae0c

Please sign in to comment.