Thread overview
[phobos] Strange access violation Mandelbug with AAs + Appender
Aug 19, 2010
David Simcha
Aug 19, 2010
Shin Fujishiro
Aug 21, 2010
David Simcha
August 19, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4681

This is a really bad one.  Someone please check to make sure I'm not doing anything really silly and that this isn't specific to some obscure detail of my setup.  If others can reproduce this, it's a really bad one and probably warrants an emergency release.

Also, it seems to occur under at least some circumstances when using ~= instead of Appender, but these circumstances are much more limited.  Though they happen in my real code, I can't seem to get a nice test case for the non-Appender case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100819/9acaacb8/attachment.html>
August 20, 2010
David Simcha <dsimcha at gmail.com> wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=4681
> 
> This is a really bad one.  Someone please check to make sure I'm not doing anything really silly and that this isn't specific to some obscure detail of my setup.  If others can reproduce this, it's a really bad one and probably warrants an emergency release.

Seems like a bug of Appender.writeCapacity().  It often writes 'cap' to
wrong address; the following assertion fails:
==========
diff --git phobos/std/array.d phobos/std/array.d
index 6b62733..e6d3a62 100644
--- phobos/std/array.d
+++ phobos/std/array.d
@@ -736,10 +736,12 @@ private:
         auto p = cast(ubyte*) (pArray.ptr + pArray.length);
         if (cap < ubyte.max)
         {
+            assert(p + 1 <= GC.addrOf(pArray.ptr) + GC.sizeOf(pArray.ptr));
             *p = cast(ubyte) cap;
         }
         else if (cap < ushort.max)
         {
+            assert(p + 3 <= GC.addrOf(pArray.ptr) + GC.sizeOf(pArray.ptr));
             *p++ = ubyte.max;
             *p++ = cast(ubyte) cap;
             *p++ = cast(ubyte) (cap >> 8);
==========


Shin
August 20, 2010
I've taken a look at this code and I'm utterly confused by it.  I highly doubt I'll be tackling this bug.  I think that if whoever wrote this can't fix it for next release, it should be rolled back to the 2.047 version.

On 8/19/2010 3:07 PM, Shin Fujishiro wrote:
> David Simcha<dsimcha at gmail.com>  wrote:
> 
>> http://d.puremagic.com/issues/show_bug.cgi?id=4681
>>
>> This is a really bad one.  Someone please check to make sure I'm not doing
>> anything really silly and that this isn't specific to some obscure detail of
>> my setup.  If others can reproduce this, it's a really bad one and probably
>> warrants an emergency release.
>> 
> Seems like a bug of Appender.writeCapacity().  It often writes 'cap' to
> wrong address; the following assertion fails:
> ==========
> diff --git phobos/std/array.d phobos/std/array.d
> index 6b62733..e6d3a62 100644
> --- phobos/std/array.d
> +++ phobos/std/array.d
> @@ -736,10 +736,12 @@ private:
>           auto p = cast(ubyte*) (pArray.ptr + pArray.length);
>           if (cap<  ubyte.max)
>           {
> +            assert(p + 1<= GC.addrOf(pArray.ptr) + GC.sizeOf(pArray.ptr));
>               *p = cast(ubyte) cap;
>           }
>           else if (cap<  ushort.max)
>           {
> +            assert(p + 3<= GC.addrOf(pArray.ptr) + GC.sizeOf(pArray.ptr));
>               *p++ = ubyte.max;
>               *p++ = cast(ubyte) cap;
>               *p++ = cast(ubyte) (cap>>  8);
> ==========
>
>
> Shin
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
> 

August 20, 2010
I wrote it, it's not that difficult - it's writing the length at the end of the array byte by byte. I'll look into fixing it.

Andrei

On 8/20/10 20:53 CDT, David Simcha wrote:
> I've taken a look at this code and I'm utterly confused by it.  I highly doubt I'll be tackling this bug. I think that if whoever wrote this can't fix it for next release, it should be rolled back to the 2.047 version.
>
> On 8/19/2010 3:07 PM, Shin Fujishiro wrote:
>> David Simcha<dsimcha at gmail.com> wrote:
>>> http://d.puremagic.com/issues/show_bug.cgi?id=4681
>>>
>>> This is a really bad one. Someone please check to make sure I'm not
>>> doing
>>> anything really silly and that this isn't specific to some obscure
>>> detail of
>>> my setup. If others can reproduce this, it's a really bad one and
>>> probably
>>> warrants an emergency release.
>> Seems like a bug of Appender.writeCapacity(). It often writes 'cap' to
>> wrong address; the following assertion fails:
>> ==========
>> diff --git phobos/std/array.d phobos/std/array.d
>> index 6b62733..e6d3a62 100644
>> --- phobos/std/array.d
>> +++ phobos/std/array.d
>> @@ -736,10 +736,12 @@ private:
>> auto p = cast(ubyte*) (pArray.ptr + pArray.length);
>> if (cap< ubyte.max)
>> {
>> + assert(p + 1<= GC.addrOf(pArray.ptr) + GC.sizeOf(pArray.ptr));
>> *p = cast(ubyte) cap;
>> }
>> else if (cap< ushort.max)
>> {
>> + assert(p + 3<= GC.addrOf(pArray.ptr) + GC.sizeOf(pArray.ptr));
>> *p++ = ubyte.max;
>> *p++ = cast(ubyte) cap;
>> *p++ = cast(ubyte) (cap>> 8);
>> ==========
>>
>>
>> Shin
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos