mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 01:07:57 +00:00
Compare commits
3 Commits
0.33.0
...
0.33.0-hf1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98f878cf10 | ||
|
|
69b47890e6 | ||
|
|
41851022d3 |
@@ -176,13 +176,11 @@ bool
|
||||
Reader::parse(Value& root, BufferSequence const& bs)
|
||||
{
|
||||
using namespace boost::asio;
|
||||
std::string s;
|
||||
s.reserve (buffer_size(bs));
|
||||
for (auto const& b : bs)
|
||||
{
|
||||
auto begin = buffer_cast<const char*>(b);
|
||||
if(! parse(begin, begin + buffer_size(b), root))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
s.append(buffer_cast<char const*>(b), buffer_size(b));
|
||||
return parse(s, root);
|
||||
}
|
||||
|
||||
/** \brief Read from 'sin' into 'root'.
|
||||
|
||||
@@ -34,7 +34,7 @@ char const* const versionString =
|
||||
// The build version number. You must edit this for each release
|
||||
// and follow the format described at http://semver.org/
|
||||
//
|
||||
"0.33.0"
|
||||
"0.33.0-hf1"
|
||||
|
||||
#if defined(DEBUG) || defined(SANITIZER)
|
||||
"+"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <ripple/test/jtx.h>
|
||||
#include <ripple/app/tx/apply.h>
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
|
||||
@@ -199,12 +200,31 @@ struct Regression_test : public beast::unit_test::suite
|
||||
}
|
||||
}
|
||||
|
||||
void testJsonInvalid()
|
||||
{
|
||||
using namespace jtx;
|
||||
using boost::asio::buffer;
|
||||
testcase("jsonInvalid");
|
||||
|
||||
std::string const request = R"json({"command":"path_find","id":19,"subcommand":"create","source_account":"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh","destination_account":"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh","destination_amount":"1000000","source_currencies":[{"currency":"0000000000000000000000000000000000000000"},{"currency":"0000000000000000000000005553440000000000"},{"currency":"0000000000000000000000004254430000000000"},{"issuer":"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh","currency":"0000000000000000000000004254430000000000"},{"issuer":"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh","currency":"0000000000000000000000004254430000000000"},{"issuer":"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh","currency":"0000000000000000000000004555520000000000"},{"currency":"0000000000000000000000004554480000000000"},{"currency":"0000000000000000000000004A50590000000000"},{"issuer":"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh","currency":"000000000000000000000000434E590000000000"},{"currency":"0000000000000000000000004742490000000000"},{"issuer":"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh","currency":"0000000000000000000000004341440000000000"}]})json";
|
||||
|
||||
Json::Value jvRequest;
|
||||
Json::Reader jrReader;
|
||||
|
||||
std::vector<boost::asio::const_buffer> buffers;
|
||||
buffers.emplace_back(buffer(request, 1024));
|
||||
buffers.emplace_back(buffer(request.data() + 1024, request.length() - 1024));
|
||||
BEAST_EXPECT(jrReader.parse(jvRequest, buffers) &&
|
||||
jvRequest && jvRequest.isObject());
|
||||
}
|
||||
|
||||
void run() override
|
||||
{
|
||||
testOffer1();
|
||||
testLowBalanceDestroy();
|
||||
testSecp256r1key();
|
||||
testFeeEscalationAutofill();
|
||||
testJsonInvalid();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user