Open
Description
The ptr::offset
function, which underlies safe slice indexing, says in its docs:
If any of the following conditions are violated, the result is Undefined Behavior...The computed offset, in bytes, cannot overflow an
isize
...memory acquired directly from allocators or memory mapped files may be too large to handle with this function.
Since the map
function is unsafe
, it's arguably fine for it to expose possible UB in this way. But I think most people reading the docs won't have any idea that this is a requirement. Maybe it would be better for (Edit: Probably just return an error if we try to mmap something larger than Deref
to panic rather than to return a slice that's "unsoundly large"?isize::MAX
?)
Metadata
Metadata
Assignees
Labels
No labels