diff options
author | Hans Bolinder <[email protected]> | 2017-05-02 12:32:39 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-05-02 12:32:39 +0200 |
commit | 37decbb64953cd65bde2f7003ef5057dc0615ff1 (patch) | |
tree | 688444cfd1f1d4447c4216ebdaee2b838915931e /erts/emulator | |
parent | 22e7443d9df041185944a7d49b30459ba4609849 (diff) | |
parent | 0298a195873c606ac885d37f54a098eca3d7905a (diff) | |
download | otp-37decbb64953cd65bde2f7003ef5057dc0615ff1.tar.gz otp-37decbb64953cd65bde2f7003ef5057dc0615ff1.tar.bz2 otp-37decbb64953cd65bde2f7003ef5057dc0615ff1.zip |
Merge branch 'maint-19' into maint
* maint-19:
Updated OTP version
Prepare release
inets: Add missing release note
dialyzer: Fix a bug regarding unknown types
erl_mseg.c: don't use invalid indices in - > cache_powered_node[]
Fix release note for OTP-14290
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/sys/common/erl_mseg.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/erts/emulator/sys/common/erl_mseg.c b/erts/emulator/sys/common/erl_mseg.c index 882c93a83c..968f71211c 100644 --- a/erts/emulator/sys/common/erl_mseg.c +++ b/erts/emulator/sys/common/erl_mseg.c @@ -87,6 +87,7 @@ static const int debruijn[32] = { #define CACHE_AREAS (32 - MSEG_ALIGN_BITS) +/* FIXME: segment sizes > 2 GB result in bogus negative indices */ #define SIZE_TO_CACHE_AREA_IDX(S) (LOG2((S)) - MSEG_ALIGN_BITS) #define MAX_CACHE_SIZE (30) @@ -396,6 +397,9 @@ static ERTS_INLINE int cache_bless_segment(ErtsMsegAllctr_t *ma, void *seg, UWor if (MSEG_FLG_IS_2POW(flags)) { int ix = SIZE_TO_CACHE_AREA_IDX(size); + if (ix < 0) + return 0; + ASSERT(ix < CACHE_AREAS); ASSERT((1 << (ix + MSEG_ALIGN_BITS)) == size); @@ -471,6 +475,9 @@ static ERTS_INLINE void *cache_get_segment(ErtsMsegAllctr_t *ma, UWord *size_p, ASSERT(IS_2POW(size)); + if (ix < 0) + return NULL; + for( i = ix; i < CACHE_AREAS; i++) { if (erts_circleq_is_empty(&(ma->cache_powered_node[i]))) |