[Issue 12699] New: Possibly wrong code in object_.d

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun May 4 05:33:51 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12699

          Issue ID: 12699
           Summary: Possibly wrong code in object_.d
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

TypeInfo_AssociativeArray is a TypeInfo class and its 'getHash' method is
implemented as:

    override hash_t getHash(in void* p) nothrow @trusted const
    {
        return _aaGetHash(cast(void*)p, this);
    }

But _aaGetHash expects an 'AA* aa' as the first parameter, not a TypeInfo. As a
result _aaGetHash will sometimes crash while attempting to access
'aa.impl.buckets', since at that offset it's accessing whatever happens to lay
at that address in a TypeInfo class.

This change was introduced in commit 87e5f64. Unless I'm misunderstanding
something I don't think the above is right.

--


More information about the Digitalmars-d-bugs mailing list