}
#undef READV
- if (addu64_overflow(*offset, *size, &min_size) || min_size > elf->size) {
+ if (uadd64_overflow(*offset, *size, &min_size) || min_size > elf->size) {
ELFDBG(elf, "out-of-bounds: %" PRIu64 " >= %" PRIu64 " (ELF size)\n",
min_size, elf->size);
return -EINVAL;
goto invalid;
}
shdrs_size = shdr_size * elf->header.section.count;
- if (addu64_overflow(shdrs_size, elf->header.section.offset, &min_size) ||
+ if (uadd64_overflow(shdrs_size, elf->header.section.offset, &min_size) ||
min_size > elf->size) {
ELFDBG(elf, "file is too short to hold sections\n");
goto invalid;
}
#define _cleanup_free_ _cleanup_(freep)
-static inline bool addu64_overflow(uint64_t a, uint64_t b, uint64_t *res)
+static inline bool uadd64_overflow(uint64_t a, uint64_t b, uint64_t *res)
{
#if (HAVE___BUILTIN_UADDL_OVERFLOW && __SIZEOF_LONG__ == 8)
return __builtin_uaddl_overflow(a, b, res);
},
});
-static int test_addu64_overflow(const struct test *t)
+static int test_uadd64_overflow(const struct test *t)
{
uint64_t res;
bool overflow;
- overflow = addu64_overflow(UINT64_MAX - 1, 1, &res);
+ overflow = uadd64_overflow(UINT64_MAX - 1, 1, &res);
assert_return(!overflow, EXIT_FAILURE);
assert_return(res == UINT64_MAX, EXIT_FAILURE);
- overflow = addu64_overflow(UINT64_MAX, 1, &res);
+ overflow = uadd64_overflow(UINT64_MAX, 1, &res);
assert_return(overflow, EXIT_FAILURE);
return EXIT_SUCCESS;
}
-DEFINE_TEST(test_addu64_overflow,
- .description = "check implementation of addu4_overflow()")
+DEFINE_TEST(test_uadd64_overflow,
+ .description = "check implementation of uadd64_overflow()")
static int test_backoff_time(const struct test *t)
{