mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
bitcoin-tx: Reject + sign in vout parsing
This commit is contained in:
@@ -275,9 +275,10 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
|
||||
|
||||
// extract and validate vout
|
||||
const std::string& strVout = vStrInputParts[1];
|
||||
int64_t vout;
|
||||
if (!ParseInt64(strVout, &vout) || vout < 0 || vout > static_cast<int64_t>(maxVout))
|
||||
const auto vout{ToIntegral<uint32_t>(strVout)};
|
||||
if (!vout || *vout > maxVout) {
|
||||
throw std::runtime_error("invalid TX input vout '" + strVout + "'");
|
||||
}
|
||||
|
||||
// extract the optional sequence number
|
||||
uint32_t nSequenceIn = CTxIn::SEQUENCE_FINAL;
|
||||
@@ -286,7 +287,7 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
|
||||
}
|
||||
|
||||
// append to transaction input list
|
||||
CTxIn txin(*txid, vout, CScript(), nSequenceIn);
|
||||
CTxIn txin{*txid, *vout, CScript{}, nSequenceIn};
|
||||
tx.vin.push_back(txin);
|
||||
}
|
||||
|
||||
|
||||
@@ -264,6 +264,14 @@
|
||||
"error_txt": "error: invalid TX sequence id 'abcdef00'",
|
||||
"description": "Try to make invalid input replaceable"
|
||||
},
|
||||
{ "exec": "./bitcoin-tx",
|
||||
"args":
|
||||
["-create",
|
||||
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:+0"],
|
||||
"return_code": 1,
|
||||
"error_txt": "error: invalid TX input vout",
|
||||
"description": "Tests the check for an invalid vout value when adding an input"
|
||||
},
|
||||
{ "exec": "./bitcoin-tx",
|
||||
"args":
|
||||
["-create",
|
||||
|
||||
Reference in New Issue
Block a user