[Issue 3677] New: null dereference with offset not memory- at safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 5 07:11:58 PST 2010


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

           Summary: null dereference with offset not memory- at safe
           Product: D
           Version: 2.038
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: michel.fortin at michelf.com


--- Comment #0 from Michel Fortin <michel.fortin at michelf.com> 2010-01-05 10:11:57 EST ---
This supposedly "safe" program under Mac OS X 10.6 doesn't give any error
neither at compile time nor at runtime, yet it isn't memory-safe at all as it
corrupts some part of the memory space.

struct S {
    uint[100000] a;
    uint b;
}

S* s = null;

@safe void main() {
    s.b = 1;
}

This happen because the offset for member "b" is very far, allowing it to falls
on another memory page which happen to exists.

-- 
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