From dae172ba22650f903d0318689c7c42a26c9055d7 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Wed, 18 Oct 2023 08:00:44 +0000 Subject: [PATCH] fix for https://github.com/Xahau/xahaud/issues/143 --- src/ripple/app/tx/impl/Import.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ripple/app/tx/impl/Import.cpp b/src/ripple/app/tx/impl/Import.cpp index 650630b63..cd44681a2 100644 --- a/src/ripple/app/tx/impl/Import.cpp +++ b/src/ripple/app/tx/impl/Import.cpp @@ -73,7 +73,7 @@ Import::getInnerTxn(STTx const& outer, beast::Journal const& j,Json::Value const std::optional xpop_storage; - if (!xpop) + if (!xpop && outer.isFieldPresent(sfBlob)) { xpop_storage = syntaxCheckXPOP(outer.getFieldVL(sfBlob), j); xpop = &(*xpop_storage); @@ -142,6 +142,14 @@ Import::preflight(PreflightContext const& ctx) auto& tx = ctx.tx; + if (!tx.isFieldPresent(sfBlob)) + { + JLOG(ctx.j.warn()) + << "Import: sfBlob was missing (should be impossible) " + << tx.getTransactionID(); + return temMALFORMED; + } + if (tx.getFieldVL(sfBlob).size() > (512 * 1024)) { JLOG(ctx.j.warn()) @@ -843,6 +851,9 @@ Import::preclaim(PreclaimContext const& ctx) if (!ctx.view.rules().enabled(featureImport)) return temDISABLED; + if (!ctx.tx.isFieldPresent(sfBlob)) + return tefINTERNAL; + // parse blob as json auto const xpop = syntaxCheckXPOP(ctx.tx.getFieldVL(sfBlob), ctx.j); @@ -1094,6 +1105,9 @@ Import::doApply() if (!view().rules().enabled(featureImport)) return temDISABLED; + if (!ctx_.tx.isFieldPresent(sfBlob)) + return tefINTERNAL; + // // Before starting decode and validate XPOP, update ImportVL seq //