Skip to content

Possible unsound public API #4

@charlesxsh

Description

@charlesxsh

At src/nuke.rs

    pub fn offset<T>(&mut self, n: usize) -> *mut T {
        unsafe {
            self.mem.add(n) as *mut T
        }
    }

The publicly accessible Nuke.offset accept a parameter n and used in the pointer.add without sufficient checks. The use of result might cause memory risks.

Suggestion:

  1. add sufficient check to fulfill the safety requirements
  2. make this method unsafe to notify developer/user

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions