mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 09:37:22 +03:00
Cast PTRDIFF_MAX to size_t before adding 1.
This fixes compilation warnings regarding integer overflow that were
introduced by 0c516a00c4 (Make *allocx()
size class overflow behavior defined.).
This commit is contained in:
parent
0c516a00c4
commit
e3195fa4a5
3 changed files with 10 additions and 10 deletions
|
|
@ -55,8 +55,8 @@ TEST_BEGIN(test_overflow)
|
|||
assert_ptr_null(mallocx(hugemax+1, 0),
|
||||
"Expected OOM for mallocx(size=%#zx, 0)", hugemax+1);
|
||||
|
||||
assert_ptr_null(mallocx(PTRDIFF_MAX+1, 0),
|
||||
"Expected OOM for mallocx(size=%#zx, 0)", ZU(PTRDIFF_MAX+1));
|
||||
assert_ptr_null(mallocx(ZU(PTRDIFF_MAX)+1, 0),
|
||||
"Expected OOM for mallocx(size=%#zx, 0)", ZU(PTRDIFF_MAX)+1);
|
||||
|
||||
assert_ptr_null(mallocx(SIZE_T_MAX, 0),
|
||||
"Expected OOM for mallocx(size=%#zx, 0)", SIZE_T_MAX);
|
||||
|
|
@ -69,9 +69,9 @@ TEST_BEGIN(test_overflow)
|
|||
assert_ptr_null(mallocx(size, 0),
|
||||
"Expected OOM for mallocx(size=%#zx, 0", size);
|
||||
|
||||
assert_ptr_null(mallocx(1, MALLOCX_ALIGN(PTRDIFF_MAX+1)),
|
||||
assert_ptr_null(mallocx(1, MALLOCX_ALIGN(ZU(PTRDIFF_MAX)+1)),
|
||||
"Expected OOM for mallocx(size=1, MALLOCX_ALIGN(%#zx))",
|
||||
ZU(PTRDIFF_MAX+1));
|
||||
ZU(PTRDIFF_MAX)+1);
|
||||
}
|
||||
TEST_END
|
||||
|
||||
|
|
|
|||
|
|
@ -232,8 +232,8 @@ TEST_BEGIN(test_overflow)
|
|||
assert_ptr_null(rallocx(p, hugemax+1, 0),
|
||||
"Expected OOM for rallocx(p, size=%#zx, 0)", hugemax+1);
|
||||
|
||||
assert_ptr_null(rallocx(p, PTRDIFF_MAX+1, 0),
|
||||
"Expected OOM for rallocx(p, size=%#zx, 0)", ZU(PTRDIFF_MAX+1));
|
||||
assert_ptr_null(rallocx(p, ZU(PTRDIFF_MAX)+1, 0),
|
||||
"Expected OOM for rallocx(p, size=%#zx, 0)", ZU(PTRDIFF_MAX)+1);
|
||||
|
||||
assert_ptr_null(rallocx(p, SIZE_T_MAX, 0),
|
||||
"Expected OOM for rallocx(p, size=%#zx, 0)", SIZE_T_MAX);
|
||||
|
|
@ -246,9 +246,9 @@ TEST_BEGIN(test_overflow)
|
|||
assert_ptr_null(rallocx(p, size, 0),
|
||||
"Expected OOM for rallocx(p, size=%#zx, 0", size);
|
||||
|
||||
assert_ptr_null(rallocx(p, 1, MALLOCX_ALIGN(PTRDIFF_MAX+1)),
|
||||
assert_ptr_null(rallocx(p, 1, MALLOCX_ALIGN(ZU(PTRDIFF_MAX)+1)),
|
||||
"Expected OOM for rallocx(p, size=1, MALLOCX_ALIGN(%#zx))",
|
||||
ZU(PTRDIFF_MAX+1));
|
||||
ZU(PTRDIFF_MAX)+1);
|
||||
|
||||
dallocx(p, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue