From 611ddbb7faa24c7293f4b367e98dd8c1153d22ec Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Thu, 14 Apr 2022 10:01:12 +0000 Subject: [PATCH] bug fix --- src/ripple/app/tx/impl/SetHook.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ripple/app/tx/impl/SetHook.cpp b/src/ripple/app/tx/impl/SetHook.cpp index 9f8d59492..561950ed2 100644 --- a/src/ripple/app/tx/impl/SetHook.cpp +++ b/src/ripple/app/tx/impl/SetHook.cpp @@ -43,7 +43,7 @@ #include #include -#define DEBUG_GUARD_CHECK 0 +#define DEBUG_GUARD_CHECK 1 #define HS_ACC() ctx.tx.getAccountID(sfAccount) << "-" << ctx.tx.getTransactionID() namespace ripple { @@ -902,6 +902,7 @@ validateCreateCode(SetHookCtx& ctx, STObject const& hookSetObj) if (section_type == 1) // type section { + printf("section_type==1 type section\n"); int type_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK(); for (int j = 0; j < type_count; ++j) { @@ -964,7 +965,7 @@ validateCreateCode(SetHookCtx& ctx, STObject const& hookSetObj) // this can only ever be 1 in production, but in testing it may also be 0 or >1 // so for completeness this loop is here but can be taken out in prod - for (int j = 0; j < result_count; ++j) + for (int k = 0; k < result_count; ++k) { int result_type = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK(); if (result_type == 0x7F || result_type == 0x7E || @@ -992,7 +993,10 @@ validateCreateCode(SetHookCtx& ctx, STObject const& hookSetObj) { JLOG(ctx.j.trace()) << "HookSet[" << HS_ACC() << "]: Malformed transaction. " - << "hook and cbak function definition must have exactly one int64_t return type."; + << (j == hook_type_idx ? "hook" : "cbak") << " j=" << j << " " + << " function definition must have exactly one int64_t return type. " + << "resultcount=" << result_count << ", resulttype=" << result_type << ", " + << "paramcount=" << param_count; return {false, 0}; } }