From: Matt Corallo Date: Tue, 24 Aug 2021 23:15:07 +0000 (+0000) Subject: [invoice] Ignore InvalidLength fields X-Git-Tag: v0.0.101~26^2~2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=c7cf5011bebc01702bd5540645e757c79fa6d265;p=rust-lightning [invoice] Ignore InvalidLength fields BOLT 11 states that a reader "MUST skip over...`p`, `h`, `s` or `n` fields that do NOT have data_lengths of 52, 52, 52 or 53, respectively." Here we do so by simply ignoring any invalid-length field. --- diff --git a/lightning-invoice/src/de.rs b/lightning-invoice/src/de.rs index ac7e7e835..777ac660f 100644 --- a/lightning-invoice/src/de.rs +++ b/lightning-invoice/src/de.rs @@ -419,7 +419,7 @@ fn parse_tagged_parts(data: &[u5]) -> Result, ParseError> { Ok(field) => { parts.push(RawTaggedField::KnownSemantics(field)) }, - Err(ParseError::Skip) => { + Err(ParseError::Skip)|Err(ParseError::Bech32Error(bech32::Error::InvalidLength)) => { parts.push(RawTaggedField::UnknownSemantics(field.into())) }, Err(e) => {return Err(e)}