[Not really OT] Crowdstrike Analysis: It was a NULL pointer from the memory unsafe C++ language.

kdevel kdevel at vogtner.de
Thu Jul 25 10:35:57 UTC 2024


On Thursday, 25 July 2024 at 07:47:11 UTC, Walter Bright wrote:

> D nails the array overflow prevention.

Sure. But D still allows corruption going unnoticed:

mems.d
```
import std.stdio;
auto foo ()
{
    int [4] f = [1, 2, 3, 4];
    int [] q = f;
    return q;
}

void main ()
{
    auto s = foo;
    writeln (s);
}
```

$ dmd mems.d
$ ./mems
[4, 0, -10016, 32767]

It requires @safe annotation PLUS -preview=dip1000 in order for 
dmd to
catch this (Error: scope variable `q` may not be returned).



More information about the Digitalmars-d mailing list