mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 01:07:54 +00:00
remove str_format
This commit is contained in:
@@ -323,7 +323,6 @@ namespace hook_api
|
|||||||
"str_find",
|
"str_find",
|
||||||
"str_replace",
|
"str_replace",
|
||||||
"str_concat",
|
"str_concat",
|
||||||
"str_format",
|
|
||||||
"str_compare"
|
"str_compare"
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -234,10 +234,6 @@ namespace hook_api
|
|||||||
DECLARE_HOOK_FUNCTION(int64_t, str_compare, uint32_t fread_ptr, uint32_t fread_len,
|
DECLARE_HOOK_FUNCTION(int64_t, str_compare, uint32_t fread_ptr, uint32_t fread_len,
|
||||||
uint32_t sread_ptr, uint32_t sread_len,
|
uint32_t sread_ptr, uint32_t sread_len,
|
||||||
uint32_t mode);
|
uint32_t mode);
|
||||||
DECLARE_HOOK_FUNCTION(int64_t, str_format, uint32_t write_ptr, uint32_t write_len,
|
|
||||||
uint32_t fread_ptr, uint32_t fread_len,
|
|
||||||
uint64_t a, uint64_t b, uint64_t c, uint64_t d,
|
|
||||||
uint64_t e, uint64_t f, uint64_t g, uint64_t h);
|
|
||||||
DECLARE_HOOK_FUNCTION(int64_t, str_concat, uint32_t write_ptr, uint32_t write_len,
|
DECLARE_HOOK_FUNCTION(int64_t, str_concat, uint32_t write_ptr, uint32_t write_len,
|
||||||
uint32_t read_ptr, uint32_t read_len,
|
uint32_t read_ptr, uint32_t read_len,
|
||||||
uint64_t operand, uint32_t operand_type);
|
uint64_t operand, uint32_t operand_type);
|
||||||
@@ -656,7 +652,6 @@ namespace hook
|
|||||||
ADD_HOOK_FUNCTION(str_replace, ctx);
|
ADD_HOOK_FUNCTION(str_replace, ctx);
|
||||||
ADD_HOOK_FUNCTION(str_compare, ctx);
|
ADD_HOOK_FUNCTION(str_compare, ctx);
|
||||||
ADD_HOOK_FUNCTION(str_concat, ctx);
|
ADD_HOOK_FUNCTION(str_concat, ctx);
|
||||||
ADD_HOOK_FUNCTION(str_format, ctx);
|
|
||||||
|
|
||||||
WasmEdge_TableInstanceContext* hostTable = WasmEdge_TableInstanceCreate(tableType);
|
WasmEdge_TableInstanceContext* hostTable = WasmEdge_TableInstanceCreate(tableType);
|
||||||
WasmEdge_ImportObjectAddTable(importObj, tableName, hostTable);
|
WasmEdge_ImportObjectAddTable(importObj, tableName, hostTable);
|
||||||
|
|||||||
@@ -5235,36 +5235,6 @@ findNul(const void* vptr, size_t len)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_HOOK_FUNCTION(
|
|
||||||
int64_t,
|
|
||||||
str_format,
|
|
||||||
uint32_t write_ptr, uint32_t write_len,
|
|
||||||
uint32_t fread_ptr, uint32_t fread_len,
|
|
||||||
uint64_t a, uint64_t b, uint64_t c, uint64_t d,
|
|
||||||
uint64_t e, uint64_t f, uint64_t g, uint64_t h)
|
|
||||||
{
|
|
||||||
HOOK_SETUP(); // populates memory_ctx, memory, memory_length, applyCtx, hookCtx on current stack
|
|
||||||
|
|
||||||
if (NOT_IN_BOUNDS(write_ptr, write_len, memory_length) ||
|
|
||||||
NOT_IN_BOUNDS(fread_ptr, fread_len, memory_length))
|
|
||||||
return OUT_OF_BOUNDS;
|
|
||||||
|
|
||||||
if (write_len == 0 || fread_len == 0)
|
|
||||||
return TOO_SMALL;
|
|
||||||
|
|
||||||
if (write_len > 1024 || fread_len > 1024)
|
|
||||||
return TOO_BIG;
|
|
||||||
|
|
||||||
// check if there's a nul terminator on format string
|
|
||||||
if (findNul(memory + fread_ptr, fread_len) < 0)
|
|
||||||
return NOT_A_STRING;
|
|
||||||
|
|
||||||
//int result = snprintf(write_ptr + memory, write_len, fread_ptr + memory, a,b,c,d,e,f,g,h);
|
|
||||||
//RH NOTE: can't do this ^ because string arguments can expose non-wasm memory
|
|
||||||
// will need to parse format string ourselves, or implement our own.
|
|
||||||
return NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Overloaded API:
|
Overloaded API:
|
||||||
If operand_type == 0:
|
If operand_type == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user