3 ms·
Segfaults, no. Usually they're a null dereference, but it could also be an out of bounds read on an array, which can leak data.
by packetlost 1y ago
Segfaults, no. Usually they're a null dereference, but it could also be an out of bounds read on an array, which can leak data.
- MrJohz 1y agoNot if it's segfaulting, no. That's the point of a segfault.
- packetlost 1y agoThis just isn't true. A segfault happens when an access happens outside of the memory space of the process, such as a 0x00 pointer. Pages are typically allocated in 4kB chunks and allocators will try to minimize syscalls to allocate more virtual pages by trying to maximize reuse of existing pages. All of this results in an out of bounds access being trivial and hard to detect without additional code to check: https://paste.sr.ht/~chiefnoah/be5864cb0d78d6691fe3e36946709f17b3aa934a https://paste.sr.ht/~chiefnoah/be5864cb0d78d6691fe3e36946709... A runaway loop can access program memory until it segfaults pretty easily.