mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-18 14:47:18 +03:00
Fix CodeQL findings: size_t flush checksum + arena_get asserts
This commit is contained in:
parent
c32f9e7e08
commit
38099e3901
3 changed files with 4 additions and 1 deletions
|
|
@ -1375,6 +1375,7 @@ arena_ptr_array_flush_impl_large(tsdn_t *tsdn, szind_t binind,
|
|||
edata_t *edata = item_edata[0].edata;
|
||||
unsigned cur_arena_ind = edata_arena_ind_get(edata);
|
||||
arena_t *cur_arena = arena_get(tsdn, cur_arena_ind, false);
|
||||
assert(cur_arena != NULL);
|
||||
|
||||
if (!arena_is_auto(cur_arena)) {
|
||||
malloc_mutex_lock(tsdn, &cur_arena->large_mtx);
|
||||
|
|
@ -1464,7 +1465,7 @@ arena_ptr_array_flush_impl(tsd_t *tsd, szind_t binind,
|
|||
* Checks for sized deallocation bugs, failing early rather than
|
||||
* corrupting metadata.
|
||||
*/
|
||||
size_t szind_sum = binind * nflush;
|
||||
size_t szind_sum = (size_t)binind * nflush;
|
||||
emap_edata_lookup_batch(tsd, &arena_emap_global, nflush,
|
||||
&arena_ptr_array_flush_ptr_getter, (void *)arr,
|
||||
&arena_ptr_array_flush_metadata_visitor, (void *)&szind_sum,
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ arena_init(tsdn_t *tsdn, unsigned ind, const arena_config_t *config) {
|
|||
static void
|
||||
arena_bind(tsd_t *tsd, unsigned ind, bool internal) {
|
||||
arena_t *arena = arena_get(tsd_tsdn(tsd), ind, false);
|
||||
assert(arena != NULL);
|
||||
arena_nthreads_inc(arena, internal);
|
||||
|
||||
if (internal) {
|
||||
|
|
|
|||
|
|
@ -642,6 +642,7 @@ malloc_init_hard(void) {
|
|||
* need it to set correct value for deferral_allowed.
|
||||
*/
|
||||
arena_t *a0 = arena_get(tsd_tsdn(tsd), 0, false);
|
||||
assert(a0 != NULL);
|
||||
hpa_shard_opts_t hpa_shard_opts = opt_hpa_opts;
|
||||
hpa_shard_opts.deferral_allowed = background_thread_enabled();
|
||||
if (pa_shard_enable_hpa(tsd_tsdn(tsd), &a0->pa_shard,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue