From 389e214fc2b75247be67da71575132814df65141 Mon Sep 17 00:00:00 2001 From: Eval EXEC Date: Wed, 8 Nov 2023 14:15:56 +0800 Subject: [PATCH] Return `Error::Overflow` in `decode.rs` --- src/decode.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/decode.rs b/src/decode.rs index 10a8503..be452f5 100644 --- a/src/decode.rs +++ b/src/decode.rs @@ -227,10 +227,7 @@ pub fn hex_decode_with_case( dst: &mut [u8], check_case: CheckCase, ) -> Result<(), Error> { - let len = dst - .len() - .checked_mul(2) - .ok_or(Error::InvalidLength(dst.len()))?; + let len = dst.len().checked_mul(2).ok_or(Error::Overflow)?; if src.len() < len || ((src.len() & 1) != 0) { return Err(Error::InvalidLength(len)); }