This commit is contained in:
Richard Holland
2023-02-20 11:04:20 +00:00
parent 1dea9bcfd6
commit 46e4df0f85

View File

@@ -2281,12 +2281,12 @@ DEFINE_HOOK_FUNCTION(
if (hookCtx.slot.find(slot_no) == hookCtx.slot.end()) if (hookCtx.slot.find(slot_no) == hookCtx.slot.end())
return DOESNT_EXIST; return DOESNT_EXIST;
if (hookCtx.slot[slot_no].entry->getSType() != STI_ARRAY)
return NOT_AN_ARRAY;
if (hookCtx.slot[slot_no].entry == 0) if (hookCtx.slot[slot_no].entry == 0)
return INTERNAL_ERROR; return INTERNAL_ERROR;
if (hookCtx.slot[slot_no].entry->getSType() != STI_ARRAY)
return NOT_AN_ARRAY;
return hookCtx.slot[slot_no].entry->downcast<ripple::STArray>().size(); return hookCtx.slot[slot_no].entry->downcast<ripple::STArray>().size();
HOOK_TEARDOWN(); HOOK_TEARDOWN();
@@ -2379,6 +2379,9 @@ DEFINE_HOOK_FUNCTION(
if (hookCtx.slot.find(slot_no) == hookCtx.slot.end()) if (hookCtx.slot.find(slot_no) == hookCtx.slot.end())
return DOESNT_EXIST; return DOESNT_EXIST;
if (hookCtx.slot[slot_no].entry == 0)
return INTERNAL_ERROR;
//RH TODO: this is a very expensive way of computing size, cache it //RH TODO: this is a very expensive way of computing size, cache it
Serializer s; Serializer s;
hookCtx.slot[slot_no].entry->add(s); hookCtx.slot[slot_no].entry->add(s);
@@ -2397,12 +2400,12 @@ DEFINE_HOOK_FUNCTION(
if (hookCtx.slot.find(parent_slot) == hookCtx.slot.end()) if (hookCtx.slot.find(parent_slot) == hookCtx.slot.end())
return DOESNT_EXIST; return DOESNT_EXIST;
if (hookCtx.slot[parent_slot].entry->getSType() != STI_ARRAY)
return NOT_AN_ARRAY;
if (hookCtx.slot[parent_slot].entry == 0) if (hookCtx.slot[parent_slot].entry == 0)
return INTERNAL_ERROR; return INTERNAL_ERROR;
if (hookCtx.slot[parent_slot].entry->getSType() != STI_ARRAY)
return NOT_AN_ARRAY;
if (new_slot == 0 && no_free_slots(hookCtx)) if (new_slot == 0 && no_free_slots(hookCtx))
return NO_FREE_SLOTS; return NO_FREE_SLOTS;
@@ -2470,6 +2473,9 @@ DEFINE_HOOK_FUNCTION(
if (fieldCode == sfInvalid) if (fieldCode == sfInvalid)
return INVALID_FIELD; return INVALID_FIELD;
if (hookCtx.slot[parent_slot].entry == 0)
return INTERNAL_ERROR;
bool copied = false; bool copied = false;
try try
@@ -2560,6 +2566,9 @@ DEFINE_HOOK_FUNCTION(
if (hookCtx.slot.find(slot_no) == hookCtx.slot.end()) if (hookCtx.slot.find(slot_no) == hookCtx.slot.end())
return DOESNT_EXIST; return DOESNT_EXIST;
if (hookCtx.slot[slot_no].entry == 0)
return INTERNAL_ERROR;
try try
{ {
ripple::STAmount& st_amt = ripple::STAmount& st_amt =