mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge bitcoin-core/gui#446: RPCConsole: Throw when overflowing size_t type for array indices
faa5e171e6bdb8f3b4027a3f06497f0de5abf766 RPCConsole: Throw when overflowing size_t type for array indices (MarcoFalke) Pull request description: To test: -> `getblock(getbestblockhash(), 1)[tx][22222222222222222222222222222]` Before: <- `868693731dea69a197c13c2cfaa41c9f78fcdeb8ab8e9f8cdf2c9025147ee7d1` (hash of the coinbase tx) After: <- `Error: Invalid result query` ACKs for top commit: jarolrod: ACK faa5e171e6bdb8f3b4027a3f06497f0de5abf766 shaavan: ACK faa5e17 Tree-SHA512: ddff39aae1c15db45928b110a9f1c42eadc5404cdfa89d67ccffc4c6af24091967d43c068ce9e0c1b863cfc4eb5b4f12373a73756a9474f8294e8a44aabc28d8
This commit is contained in:
parent
14b4981a66
commit
e51e4ee674
@ -225,10 +225,11 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes
|
||||
UniValue subelement;
|
||||
if (lastResult.isArray())
|
||||
{
|
||||
for(char argch: curarg)
|
||||
if (!IsDigit(argch))
|
||||
throw std::runtime_error("Invalid result query");
|
||||
subelement = lastResult[LocaleIndependentAtoi<int>(curarg)];
|
||||
const auto parsed{ToIntegral<size_t>(curarg)};
|
||||
if (!parsed) {
|
||||
throw std::runtime_error("Invalid result query");
|
||||
}
|
||||
subelement = lastResult[parsed.value()];
|
||||
}
|
||||
else if (lastResult.isObject())
|
||||
subelement = find_value(lastResult, curarg);
|
||||
|
Loading…
Reference in New Issue
Block a user