Skip to content

Commit 48f8ed6

Browse files
fmayergithub-actions[bot]
authored andcommitted
Automerge: [compiler-rt] [sanitizer] avoid UB in allocator (#126977)
2 parents 844e02c + 6936fad commit 48f8ed6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ struct SizeClassAllocator32LocalCache {
166166
DCHECK_GT(c->count, 0);
167167
}
168168
void *res = c->batch[--c->count];
169-
PREFETCH(c->batch[c->count - 1]);
169+
PREFETCH(c->batch[c->count > 0 ? c->count - 1 : 0]);
170170
stats_.Add(AllocatorStatAllocated, c->class_size);
171171
return res;
172172
}

0 commit comments

Comments
 (0)