[Issue 12516] New: TypeInfo.getHash should not be trusted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 3 16:11:55 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12516

           Summary: TypeInfo.getHash should not be trusted
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: dspies at ualberta.ca


--- Comment #0 from David Spies <dspies at ualberta.ca> 2014-04-03 16:11:53 PDT ---
When getHash is overridden, it may try to dereference the void pointer, so it's
not safe if the pointer is to the wrong type.

import std.string;

static int x = 35873;

@safe
void main() {
    typeid(string).getHash(&x);
}

---

An example program which segfaults within a @safe method

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


More information about the Digitalmars-d-bugs mailing list