summaryrefslogtreecommitdiffstats
path: root/src/jemalloc.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2015-09-15 07:49:09 (GMT)
committerJason Evans <jasone@canonware.com>2015-09-15 07:51:09 (GMT)
commit8c485b02a61ab96d4d248e234302edf57577b77d (patch)
tree607286e2d999fa216ffa9d06242fccae160ca93b /src/jemalloc.c
parent0108b1fd0411db444d4074582013879f757fa1df (diff)
downloadjemalloc-8c485b02a61ab96d4d248e234302edf57577b77d.zip
jemalloc-8c485b02a61ab96d4d248e234302edf57577b77d.tar.gz
jemalloc-8c485b02a61ab96d4d248e234302edf57577b77d.tar.bz2
Fix ixallocx_prof() to check for size greater than HUGE_MAXCLASS.
Diffstat (limited to 'src/jemalloc.c')
-rw-r--r--src/jemalloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c
index a29e613..f403306 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -2286,8 +2286,12 @@ ixallocx_prof(tsd_t *tsd, void *ptr, size_t old_usize, size_t size,
prof_active = prof_active_get_unlocked();
old_tctx = prof_tctx_get(ptr);
/* Clamp extra if necessary to avoid (size + extra) overflow. */
- if (unlikely(size + extra > HUGE_MAXCLASS))
+ if (unlikely(size + extra > HUGE_MAXCLASS)) {
+ /* Check for size overflow. */
+ if (size > HUGE_MAXCLASS)
+ return (old_usize);
extra = HUGE_MAXCLASS - size;
+ }
/*
* usize isn't knowable before ixalloc() returns when extra is non-zero.
* Therefore, compute its maximum possible value and use that in