wasm_gzip icon indicating copy to clipboard operation
wasm_gzip copied to clipboard

gzipDecode error: Uncaught RangeError: offset is out of bounds

Open mbykovskyy opened this issue 4 years ago • 1 comments

I'm not sure if the issue is with this library or the Deno internals. I decode thousands of gzip encoded blobs in a loop, by calling gzipDecode.

for await (const serp of readCSVObjects(f)) {
    const res = await fetch(url)
    const body = new Uint8Array(await res.arrayBuffer())
    const html = gzipDecode(body)
    await Deno.writeFile(dest, html)
}

Over time gzipDecode fails with the following error.

error: Uncaught RangeError: offset is out of bounds
  getUint8Memory0().set(arg, ptr / 1);
                    ^
    at Uint8Array.set (<anonymous>)
    at passArray8ToWasm0 (https://raw.githubusercontent.com/manyuanrong/wasm_gzip/master/wasm.js:18:21)
    at gzip_decode (https://raw.githubusercontent.com/manyuanrong/wasm_gzip/master/wasm.js:42:14)
    at gzipDecode (mod.ts:7:10)

I checked the gz blob and it was valid. I.e. I was able to decode it successfully with other tools.

mbykovskyy avatar Jul 22 '20 00:07 mbykovskyy

Can you provide the smallest sample code that failed? So that I can locate the problem

manyuanrong avatar Jul 22 '20 01:07 manyuanrong