From f136ad6a8ecaa19ba2e1298f69bc8289e8f5a653 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 22 Jan 2015 20:15:32 +0100 Subject: [PATCH] a transaction RLP with more fiels than 9 is invalid according to yellow paper --- libethereum/Transaction.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libethereum/Transaction.cpp b/libethereum/Transaction.cpp index 78abd6267..345e379af 100644 --- a/libethereum/Transaction.cpp +++ b/libethereum/Transaction.cpp @@ -46,6 +46,10 @@ Transaction::Transaction(bytesConstRef _rlpData, CheckSignature _checkSig) byte v = rlp[field = 6].toInt() - 27; h256 r = rlp[field = 7].toInt(); h256 s = rlp[field = 8].toInt(); + + if (rlp.itemCount() > 9) + BOOST_THROW_EXCEPTION(BadRLP() << errinfo_comment("to many fields in the transaction RLP")); + m_vrs = SignatureStruct{ r, s, v }; if (_checkSig >= CheckSignature::Range && !m_vrs.isValid()) BOOST_THROW_EXCEPTION(InvalidSignature());