Remove PRI macro control in wasm_application.c (#905)

And fix read_leb byte count check issue in aot_compiler.c
This commit is contained in:
Wenyong Huang 2021-12-20 19:22:28 +08:00 committed by GitHub
parent 4cc4625a2b
commit af251e45ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 20 deletions

View File

@ -586,16 +586,7 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
u.parts[0] = argv1[k];
u.parts[1] = argv1[k + 1];
k += 2;
#ifdef PRIx64
os_printf("0x%" PRIx64 ":i64", u.val);
#else
char buf[16];
if (sizeof(long) == 4)
snprintf(buf, sizeof(buf), "%s", "0x%llx:i64");
else
snprintf(buf, sizeof(buf), "%s", "0x%lx:i64");
os_printf(buf, u.val);
#endif
break;
}
case VALUE_TYPE_F32:
@ -645,17 +636,8 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
case VALUE_TYPE_V128:
{
uint64 *v = (uint64 *)(argv1 + k);
#if defined(PRIx64)
os_printf("<0x%016" PRIx64 " 0x%016" PRIx64 ">:v128", *v,
*(v + 1));
#else
if (4 == sizeof(long)) {
os_printf("<0x%016llx 0x%016llx>:v128", *v, *(v + 1));
}
else {
os_printf("<0x%016lx 0x%016lx>:v128", *v, *(v + 1));
}
#endif /* PRIx64 */
k += 4;
break;
}

View File

@ -64,8 +64,9 @@ read_leb(const uint8 *buf, const uint8 *buf_end, uint32 *p_offset,
}
bcnt += 1;
}
if (bcnt > (((maxbits + 8) >> 3) - (maxbits + 8))) {
aot_set_last_error("read leb failed: unsigned leb overflow.");
if (bcnt > (maxbits + 6) / 7) {
aot_set_last_error("read leb failed: "
"integer representation too long");
return false;
}
if (sign && (shift < maxbits) && (byte & 0x40)) {