haxetink / tink_chunk

Chunks of readonly binary data.
The Unlicense
8 stars 5 forks source link

Stack overflow in CompoundChunk.blitTo #9

Closed kevinresol closed 5 years ago

kevinresol commented 6 years ago

I experienced this when using tink_http to handle a large file upload.

import tink.Chunk;
import haxe.io.Bytes;

class Main {
    static function main() {
        var bytes = Bytes.alloc(256);
        var chunk:Chunk = Chunk.EMPTY;
        for(i in 0...10000) chunk = chunk & bytes;
        var out = Bytes.alloc(chunk.length);
        chunk.blitTo(out, 0);
    }
}
DavisDevelopment commented 5 years ago

I'm just pinging this issue to see if anyone has found a workaround?

kevinresol commented 5 years ago

This also crashes Source.ofJsFile(...).all().next(chunk -> chunk.toBytes()) when reading a large file in browser. I also wish to see a fix.