Skip to content

Commit

Permalink
avoid void pointer arithmetics, which is a GCC extention
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Aug 14, 2024
1 parent c9967c7 commit 9ac37b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtimes/native/src/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ static uint32_t mul_u32_with_overflow_check(uint32_t a, uint32_t b)
static void bounds_check(const void *sp, size_t sz)
{
const void *memory_sp = (const void *)memory;
const void *memory_ep = memory_sp + (1 << 16);
const void *ep = sp + sz;
const void *memory_ep = (const uint8_t *)memory_sp + (1 << 16);
const void *ep = (const uint8_t *)sp + sz;
if (ep <= sp || sp < memory_sp || memory_ep < ep) {
out_of_bounds_access();
}
Expand All @@ -75,7 +75,7 @@ static void bounds_check(const void *sp, size_t sz)
static void bounds_check_cstr(const char *p)
{
const void *memory_sp = (const void *)memory;
const void *memory_ep = memory_sp + (1 << 16);
const void *memory_ep = (const uint8_t *)memory_sp + (1 << 16);
if (p < memory_sp || memory_ep <= p) {
out_of_bounds_access();
}
Expand Down

0 comments on commit 9ac37b6

Please sign in to comment.