Fix ixallocx_prof() size+extra overflow.
Fix ixallocx_prof() to clamp the extra parameter if size+extra would overflow HUGE_MAXCLASS.
This commit is contained in:
parent
8f57e3f1ae
commit
4acb6c7ff3
@ -2275,6 +2275,9 @@ ixallocx_prof(tsd_t *tsd, void *ptr, size_t old_usize, size_t size,
|
|||||||
prof_tctx_t *old_tctx, *tctx;
|
prof_tctx_t *old_tctx, *tctx;
|
||||||
|
|
||||||
old_tctx = prof_tctx_get(ptr);
|
old_tctx = prof_tctx_get(ptr);
|
||||||
|
/* Clamp extra if necessary to avoid (size + extra) overflow. */
|
||||||
|
if (unlikely(size + extra > HUGE_MAXCLASS))
|
||||||
|
extra = HUGE_MAXCLASS - size;
|
||||||
/*
|
/*
|
||||||
* usize isn't knowable before ixalloc() returns when extra is non-zero.
|
* usize isn't knowable before ixalloc() returns when extra is non-zero.
|
||||||
* Therefore, compute its maximum possible value and use that in
|
* Therefore, compute its maximum possible value and use that in
|
||||||
|
Loading…
Reference in New Issue
Block a user