File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -2961,15 +2961,18 @@ arena_map_mark_used(uintptr_t arena_base, int is_used)
2961
2961
* again (do the full tree traversal).
2962
2962
*/
2963
2963
n_hi -> arenas [i3 ].tail_hi = is_used ? tail : 0 ;
2964
- uintptr_t arena_base_next = arena_base + ARENA_SIZE ;
2965
- arena_map3_t * n_lo = arena_map_get ((block * )arena_base_next , is_used );
2966
- if (n_lo == NULL ) {
2967
- assert (is_used ); /* otherwise should already exist */
2968
- n_hi -> arenas [i3 ].tail_hi = 0 ;
2969
- return 0 ; /* failed to allocate space for node */
2964
+ uintptr_t arena_next = arena_base + ARENA_SIZE ;
2965
+ /* check for overflow of arena_next */
2966
+ if (arena_next > arena_base ) {
2967
+ arena_map3_t * n_lo = arena_map_get ((block * )arena_next , is_used );
2968
+ if (n_lo == NULL ) {
2969
+ assert (is_used ); /* otherwise should already exist */
2970
+ n_hi -> arenas [i3 ].tail_hi = 0 ;
2971
+ return 0 ; /* failed to allocate space for node */
2972
+ }
2973
+ int i3_next = MAP3_INDEX (arena_next );
2974
+ n_lo -> arenas [i3_next ].tail_lo = is_used ? tail : 0 ;
2970
2975
}
2971
- int i3_next = MAP3_INDEX (arena_base_next );
2972
- n_lo -> arenas [i3_next ].tail_lo = is_used ? tail : 0 ;
2973
2976
}
2974
2977
return 1 ;
2975
2978
}
You can’t perform that action at this time.
0 commit comments