[Issue 5176] Limit static object sizes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 20 01:27:07 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=5176



--- Comment #31 from deadalnix <deadalnix at gmail.com> 2013-05-20 01:26:56 PDT ---
(In reply to comment #30)
> (In reply to comment #29)
> > The thing is that you may get over the page protection by several dereferences.
> 
> What do you mean by several dereferences?
> Can you provide an example?

Yes sure. Let's consider the example below :

struct Foo {
    ubyte[512] bar;
}

struct Buzz {
    ubyte[256] pad;
    Foo[8] qux;
}

Buzz* b;

auto deref1 = (b.qux[7]); // deref below 4kb.
deref1.bar[300]; // offset is bellow 4kb, but teh address is above 4kb.

If we consider deref address only no check happens here. So it is needed to
base the decision to check or not not based on the actual address, but
according the the maximal address possibly reached.

In other words, a 4kb+ conglomerate of value types need null check on every
single pointer operation, even the on bellow 4kb.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list