A serious security bug... caused by no bounds checking.

Martin Krejcirik mk-junk at i-line.cz
Thu Apr 10 15:54:57 PDT 2014


On 10.4.2014 19:12, Steven Schveighoffer wrote:
> void foo(T)(T[] x) @safe
> {
>    x[5] = 3;
> }

Is this common practice ? I'd wouldn't call it a safe design. There
should be a length check or version check:

version(D_NoBoundsChecks) static assert(0, "bounds checking required");

But I get your point, I have always thought of bounds checking like an
optional safety net, you think of it like a required feature.

-- 
mk


More information about the Digitalmars-d mailing list