Skip to content

Commit 808a869

Browse files
committed
Construct string only when it is function export.
Signed-off-by: Takeshi Yoneda <[email protected]>
1 parent 41a9ac6 commit 808a869

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/common/bytecode_util.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ bool BytecodeUtil::getAbiVersion(std::string_view bytecode, proxy_wasm::AbiVersi
5353
if (!parseVarint(pos, end, export_name_size) || pos + export_name_size > end) {
5454
return false;
5555
}
56-
const std::string export_name = {pos, export_name_size};
56+
const auto name_begin = pos;
5757
pos += export_name_size;
5858
if (pos + 1 > end) {
5959
return false;
6060
}
6161
// Check if it is a function type export
6262
if (*pos++ == 0x00) {
63+
const std::string export_name = {name_begin, export_name_size};
6364
// Check the name of the function.
6465
if (export_name == "proxy_abi_version_0_1_0") {
6566
ret = AbiVersion::ProxyWasm_0_1_0;

0 commit comments

Comments
 (0)