From 4b44e787cbf752ccd63c7ea04986865bd2929fb2 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 23 Oct 2023 13:45:51 -0700 Subject: [PATCH] return early if no bytes given for the transaction --- web3_proxy/src/app/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web3_proxy/src/app/mod.rs b/web3_proxy/src/app/mod.rs index 334c1775..31be8201 100644 --- a/web3_proxy/src/app/mod.rs +++ b/web3_proxy/src/app/mod.rs @@ -1103,6 +1103,10 @@ impl App { let bytes = Bytes::from_str(params) .map_err(|_| Web3ProxyError::BadRequest("Unable to parse params as bytes".into()))?; + if bytes.is_empty() { + return Err(Web3ProxyError::BadRequest("empty bytes".into())); + } + let rlp = Rlp::new(bytes.as_ref()); let tx = Transaction::decode(&rlp).map_err(|_| {