Memory safe in D

H. S. Teoh hsteoh at qfbox.info
Tue Mar 12 19:48:22 UTC 2024


On Tue, Mar 12, 2024 at 07:33:17PM +0000, Alex via Digitalmars-d wrote:
[...]
> I think it depends on what we means "memory safety".

In D, memory safety means memory cannot be corrupted. That is, writing
to a pointer intended for one variable will not overwrite values of
another, unrelated variable.  This includes things like buffer
overflows, stack corruption, overwriting pointers with maliciously
crafted values that causes data to be written to places that isn't
supposed to be written to, etc..

Dereferencing a null pointer is not a memory corruption according to
this definition. (Even though in practice, having an application abort
because of a null pointer can also become an issue, e.g., if a malicious
outsider is able to trigger that condition consistently, it could be
exploited in a DoS attack.)


T

-- 
Life is complex. It consists of real and imaginary parts. -- YHL


More information about the Digitalmars-d mailing list