ByteArray uncompress failure causes Memory leaks

NEW
Unassigned

Status

Tamarin
Virtual Machine
5 years ago
5 years ago

People

(Reporter: Dan Schaffer, Unassigned)

Tracking

(Blocks: 1 bug)

Details

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
A memory leak was injected into the shell from Workers changes.   The testcase compresses a simple string, modifies a byte so the uncompress should fail, then does the uncompress.  The correct exception is thrown but the debug shell reports Memory leaks.

I believe the memory leak will also reproduce with the deflate/zlib compression if the correct byte is modified to cause zlib to fail.

steps to reproduce:
1) build the debug shell
2) compile the testcase into .abc  (abc testfile is attached)
bug.as:
import flash.utils.ByteArray
var b1:ByteArray = new ByteArray();
b1.writeUTF("string");
b1.compress("lzma");
var b2:ByteArray = new ByteArray();
var i:uint=120;
b2.clear();
b1.position = 0;
b1.readBytes(b2);
var byteOffset:uint = i / 8;
var bitOffset:uint  = i % 8;
var oldByte:uint = b2[byteOffset];
var oldBit:uint  = (oldByte >> bitOffset) & 0x1;
var newByte:uint = (oldByte ^ (oldBit << bitOffset)) & 0xFF;
b2[byteOffset] = newByte;
var result;
try {
    b2.uncompress("lzma");
} catch (e) {
    print("i="+i+" error="+e.toString());
}

3) run:
$ avmshell_d bug.abc
i=120 error=Error: Error #2058
Leaks!Trace/BPT trap: 5

actual is :
i=120 error=Error: Error #2058
Leaks!Trace/BPT trap: 5

expected should be no leak:
i=120 error=Error: Error #2058
(Reporter)

Comment 1

5 years ago
Created attachment 647165 [details]
testcase source
(Reporter)

Comment 2

5 years ago
Created attachment 647167 [details]
testcase binary abc
(Reporter)

Updated

5 years ago
Blocks: 695061

Comment 3

5 years ago
changeset: 7516:b4e4ed919a2d
user:      Dan Schaffer <Dan.Schaffer@adobe.com>
summary:   bug 778727: disable failing testcases due to bug when ByteArray uncompresses invalid error (r=dschaffe)

http://hg.mozilla.org/tamarin-redux/rev/b4e4ed919a2d
You need to log in before you can comment on or make changes to this bug.