Skip to content

Commit af251e4

Browse files
authored
Remove PRI macro control in wasm_application.c (#905)
And fix read_leb byte count check issue in aot_compiler.c
1 parent 4cc4625 commit af251e4

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

core/iwasm/common/wasm_application.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -586,16 +586,7 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
586586
u.parts[0] = argv1[k];
587587
u.parts[1] = argv1[k + 1];
588588
k += 2;
589-
#ifdef PRIx64
590589
os_printf("0x%" PRIx64 ":i64", u.val);
591-
#else
592-
char buf[16];
593-
if (sizeof(long) == 4)
594-
snprintf(buf, sizeof(buf), "%s", "0x%llx:i64");
595-
else
596-
snprintf(buf, sizeof(buf), "%s", "0x%lx:i64");
597-
os_printf(buf, u.val);
598-
#endif
599590
break;
600591
}
601592
case VALUE_TYPE_F32:
@@ -645,17 +636,8 @@ wasm_application_execute_func(WASMModuleInstanceCommon *module_inst,
645636
case VALUE_TYPE_V128:
646637
{
647638
uint64 *v = (uint64 *)(argv1 + k);
648-
#if defined(PRIx64)
649639
os_printf("<0x%016" PRIx64 " 0x%016" PRIx64 ">:v128", *v,
650640
*(v + 1));
651-
#else
652-
if (4 == sizeof(long)) {
653-
os_printf("<0x%016llx 0x%016llx>:v128", *v, *(v + 1));
654-
}
655-
else {
656-
os_printf("<0x%016lx 0x%016lx>:v128", *v, *(v + 1));
657-
}
658-
#endif /* PRIx64 */
659641
k += 4;
660642
break;
661643
}

core/iwasm/compilation/aot_compiler.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ read_leb(const uint8 *buf, const uint8 *buf_end, uint32 *p_offset,
6464
}
6565
bcnt += 1;
6666
}
67-
if (bcnt > (((maxbits + 8) >> 3) - (maxbits + 8))) {
68-
aot_set_last_error("read leb failed: unsigned leb overflow.");
67+
if (bcnt > (maxbits + 6) / 7) {
68+
aot_set_last_error("read leb failed: "
69+
"integer representation too long");
6970
return false;
7071
}
7172
if (sign && (shift < maxbits) && (byte & 0x40)) {

0 commit comments

Comments
 (0)