benfred / py-spy

Sampling profiler for Python programs
MIT License
12.14k stars 400 forks source link

Potential misaligned pointer passed to `slice` #616

Open shinmao opened 9 months ago

shinmao commented 9 months ago

The source of unsoundness

Hi, I am wondering why the warning of alignment was suppressed here: https://github.com/benfred/py-spy/blob/492b41c07c26c6edbe061da942c8dae41d86091e/src/python_data_access.rs#L27-L31 bytes comes from the copy method of remoteprocess::ProcessMemory, which would copy and return a series of u8 from another address. Isn't it unsound to to cast to char which is aligned to 4 bytes? Please check and would love to have some discussion:)