[Issue 21857] New: TypeInfo_Array.compare can give wrong result when either array exceeds 2GB

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 24 02:02:45 UTC 2021


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

          Issue ID: 21857
           Summary: TypeInfo_Array.compare can give wrong result when
                    either array exceeds 2GB
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: n8sh.secondary at hotmail.com

Current code:

https://github.com/dlang/druntime/blob/b4209f33e7705a58d101e5ba906bfa5d10799faa/src/object.d#L918-L934

---
    override int compare(in void* p1, in void* p2) const
    {
        void[] a1 = *cast(void[]*)p1;
        void[] a2 = *cast(void[]*)p2;

        // ... 

        return cast(int)a1.length - cast(int)a2.length;
    }
--

--


More information about the Digitalmars-d-bugs mailing list