Bug 3677 – null dereference with offset not memory-@safe
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2010-01-05T07:11:00Z
Last change time
2015-06-09T01:27:14Z
Assigned to
nobody
Creator
michel.fortin
Comments
Comment #0 by michel.fortin — 2010-01-05T07:11:57Z
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.
Comment #1 by braddr — 2011-02-06T15:39:03Z
Mass migration of bugs marked as x86-64 to just x86. The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app.
Comment #2 by yebblies — 2011-06-16T01:04:46Z
This bug is a subset of issue 5176
*** This issue has been marked as a duplicate of issue 5176 ***