www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12516] New: TypeInfo.getHash should not be trusted

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 puremagic.com
        ReportedBy: dspies ualberta.ca



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: -------
Apr 03 2014