[Issue 14134] Free of large array does not work

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Feb 6 12:00:46 PST 2015


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

--- Comment #7 from Rainer Schuetze <r.sagitario at gmx.de> ---
Checking the code from 2.066 again, it corrupts memory

- if the array.ptr offset from the base pointer in a small allocation is larger
than 15 bytes
- if the array.ptr offset from the base pointer in a large allocation is larger
than 4095 bytes.

So apart from some rather obscure indices above 0, but below some threshold,
only passing the array base pointer actually worked. Making other pointers
raise an error seems an improvement.

For a partial length, it didn't make much of a difference unless struct
destructors have to be called. Not calling all of them is very probably an
error, too. Informing the user about this with an error should be ok.

This leaves the case when a wrong size didn't cause any issues. An error could
be considered annoying, so maybe we could relax option 3 a little for types
without destructor.

--


More information about the Digitalmars-d-bugs mailing list