image-size: ERR_BUFFER_OUT_OF_BOUNDS while parsing png (windows, linux subsystem)

Running imageSize on the attached png throws an out of bounds exeption while using Linux on Windows. The package works fine for other png and jpg files. The package works fine parsing the same file on macOS.

Error:

internal/buffer.js:70
    throw new ERR_BUFFER_OUT_OF_BOUNDS();
    ^
RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to access memory outside buffer bounds
    at boundsError (internal/buffer.js:70:11)
    at Buffer.readUInt16LE (internal/buffer.js:229:5)
    at Object.validate (/<redacted>/node_modules/image-size/dist/types/cur.js:7:20)
    at finder (/<redacted>/node_modules/image-size/dist/detector.js:26:55)
    at Array.find (<anonymous>)
    at Object.detector (/<redacted>/node_modules/image-size/dist/detector.js:27:17)
    at lookup (/<redacted>/node_modules/image-size/dist/index.js:32:29)
    at imageSize (/<redacted>/node_modules/image-size/dist/index.js:102:16)
    at <redacted> (/<redacted>/makeManifest.js:20:7)
  code: 'ERR_BUFFER_OUT_OF_BOUNDS'
}

Image file: handset_icon@3x

System: OS: Ubuntu 18.04 bionic [Ubuntu on Windows 10] Kernel: x86_64 Linux 4.4.0-18362-Microsoft CPU: Intel Core i7-8565U @ 8x 2.001Ghz image-size version: 0.8.3 (npm)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Unfortunately the Node upgrade did not solve the issue…

We’re upgrading to Node 16. We hope this will also magically solve this issue. I will keep you posted