mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
Avoid unsigned integer overflow in bitcoin-tx
This commit is contained in:
parent
e3de7cb903
commit
faa75fa193
2 changed files with 5 additions and 3 deletions
|
@ -433,13 +433,16 @@ static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strIn
|
||||||
if (pos==0)
|
if (pos==0)
|
||||||
throw std::runtime_error("TX output value not specified");
|
throw std::runtime_error("TX output value not specified");
|
||||||
|
|
||||||
if (pos != std::string::npos) {
|
if (pos == std::string::npos) {
|
||||||
|
pos = 0;
|
||||||
|
} else {
|
||||||
// Extract and validate VALUE
|
// Extract and validate VALUE
|
||||||
value = ExtractAndValidateValue(strInput.substr(0, pos));
|
value = ExtractAndValidateValue(strInput.substr(0, pos));
|
||||||
|
++pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract and validate DATA
|
// extract and validate DATA
|
||||||
std::string strData = strInput.substr(pos + 1, std::string::npos);
|
const std::string strData{strInput.substr(pos, std::string::npos)};
|
||||||
|
|
||||||
if (!IsHex(strData))
|
if (!IsHex(strData))
|
||||||
throw std::runtime_error("invalid TX output data");
|
throw std::runtime_error("invalid TX output data");
|
||||||
|
|
|
@ -45,7 +45,6 @@ shift-base:test/fuzz/crypto_diff_fuzz_chacha20.cpp
|
||||||
# job.
|
# job.
|
||||||
unsigned-integer-overflow:addrman.cpp
|
unsigned-integer-overflow:addrman.cpp
|
||||||
unsigned-integer-overflow:arith_uint256.h
|
unsigned-integer-overflow:arith_uint256.h
|
||||||
unsigned-integer-overflow:bitcoin-tx.cpp
|
|
||||||
unsigned-integer-overflow:common/bloom.cpp
|
unsigned-integer-overflow:common/bloom.cpp
|
||||||
unsigned-integer-overflow:chain.cpp
|
unsigned-integer-overflow:chain.cpp
|
||||||
unsigned-integer-overflow:chain.h
|
unsigned-integer-overflow:chain.h
|
||||||
|
|
Loading…
Add table
Reference in a new issue