-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.T-opsemRelevant to the opsem teamRelevant to the opsem team
Description
Location (URL)
GlobalAlloc and Allocator trait documentation
Summary
The core::ptr module's allocation paragraph states that base + size <= usize::MAX must hold for an allocation, which is later reinforced by the statement in pointer::add: vec.as_ptr().add(vec.len()) is always safe. This is not documented as a requirement for allocations in the GlobalAlloc and Allocator traits.
An allocator following the current trait documentation could cause UB by allocating 1 byte at usize::MAX.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.T-opsemRelevant to the opsem teamRelevant to the opsem team
Type
Fields
Give feedbackNo fields configured for issues without a type.