Skip to content

TypeError: Cannot read property 'length' of null #17182

@LavrovArtem

Description

@LavrovArtem

return (buffers.length === 1 ? buffers[0] : Buffer.concat(buffers, nread));

const zlib = require('zlib');

const arr= new Int8Array([0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
console.log(zlib.gunzipSync(arr))
zlib.js:488
  return (buffers.length === 1 ? buffers[0] : Buffer.concat(buffers, nread));
                  ^

TypeError: Cannot read property 'length' of null
    at processChunkSync (zlib.js:488:19)
    at zlibBufferSync (zlib.js:119:12)
    at Object.gunzipSync (zlib.js:646:14)
    at Object.<anonymous> (D:\tests\2017\11\test-zlib.js:7:18)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Function.Module.runMain (module.js:682:10)
  • Version: v9.0.0
  • Platform: Windows 8.1 64-bit

It works fine on 6, 7 and 8 node versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.zlibIssues and PRs related to the zlib subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions