[Issue 5176] Limit static object sizes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 9 17:21:31 PST 2013


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


hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh at quickfur.ath.cx


--- Comment #13 from hsteoh at quickfur.ath.cx 2013-01-09 17:21:29 PST ---
Very large structs can also corrupt memory not just via null references, but
via stack overflow. (Just pass a large struct by value down a few levels of
recursion, and the stack will overflow.) And it's easier than one might think:

struct S {
  dchar[256] buffer;
}

Looks small, right? Well, sizeof(dchar)=4, which means sizeof(S)=1024. On
Linux, the default stacksize is about 4KB. That means passing S by value down
just 3-4 levels of recursion is enough to overflow the stack. And currently, I
don't think DMD does any handling for stack overflow; it just crashes (and may
corrupt memory as well, I didn't look into it).

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