On Saturday, 21 April 2018 at 14:25:58 UTC, Cym13 wrote:
On Saturday, 21 April 2018 at 13:54:14 UTC, H. S. Teoh wrote:
On Sat, Apr 21, 2018 at 01:30:55PM +0000, Cym13 via Digitalmars-d-learn wrote:
On Saturday, 21 April 2018 at 12:08:09 UTC, Dmitry Olshansky wrote:
[...]
> Unbounded allocation on stack is kind of anti-pattern and a > potential DoS vector.

I'm having trouble seeing how unbounded heap allocations aren't equally a potential DoS vector.
[...]

Generally speaking, the heap is much bigger than the stack (often many times so) and so is less prone to overflow. Though it's true, it still does happen if you just blindly allocate memory based on unsanitized external input.


T

Wait, why? Don't they share the same address space and grow in opposite directions?

That was true more like 25 years ago. Same address space is obviously still true. These days heap is usually not using sbrk which is basically what you describe. Also imagine threads and tell me which stack grows towards which ;)

Heap is allocated with mmap on Posix’es and VirtualAlloc on Windows. Stack is typically fixed limit imposed by ulimit and how it grows is beside the point really.




Reply via email to