Skip to content

Commit e23f9b9

Browse files
committed
fix: edit crc32c to avoid integer overflow and triggering address sanitizer
1 parent 7669099 commit e23f9b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/crc32c/src/crc32c_round_up.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace crc32c {
1313
// Returns the smallest number >= the given number that is evenly divided by N.
1414
//
1515
// N must be a power of two.
16-
template <int N>
16+
template <uint64_t N>
1717
constexpr inline uintptr_t RoundUp(uintptr_t pointer) {
1818
static_assert((N & (N - 1)) == 0, "N must be a power of two");
1919
return (pointer + (N - 1)) & ~(N - 1);
@@ -22,7 +22,7 @@ constexpr inline uintptr_t RoundUp(uintptr_t pointer) {
2222
// Returns the smallest address >= the given address that is aligned to N bytes.
2323
//
2424
// N must be a power of two.
25-
template <int N>
25+
template <uint64_t N>
2626
constexpr inline const uint8_t* RoundUp(const uint8_t* pointer) {
2727
static_assert((N & (N - 1)) == 0, "N must be a power of two");
2828
return reinterpret_cast<uint8_t*>(

0 commit comments

Comments
 (0)