mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 05:33:06 +00:00
Fix off-by-one in stats_arenas_i_bins_j and stats_arenas_i_lextents_j bounds checks
Same pattern as arenas_bin_i_index: used > instead of >= allowing access one past the end of bstats[] and lstats[] arrays. Add unit tests that verify boundary indices return ENOENT.
This commit is contained in:
@@ -3998,7 +3998,7 @@ CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_nonfull_slabs,
|
||||
static const ctl_named_node_t *
|
||||
stats_arenas_i_bins_j_index(
|
||||
tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t j) {
|
||||
if (j > SC_NBINS) {
|
||||
if (j >= SC_NBINS) {
|
||||
return NULL;
|
||||
}
|
||||
return super_stats_arenas_i_bins_j_node;
|
||||
@@ -4022,7 +4022,7 @@ CTL_RO_CGEN(config_stats, stats_arenas_i_lextents_j_curlextents,
|
||||
static const ctl_named_node_t *
|
||||
stats_arenas_i_lextents_j_index(
|
||||
tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t j) {
|
||||
if (j > SC_NSIZES - SC_NBINS) {
|
||||
if (j >= SC_NSIZES - SC_NBINS) {
|
||||
return NULL;
|
||||
}
|
||||
return super_stats_arenas_i_lextents_j_node;
|
||||
|
||||
Reference in New Issue
Block a user