Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.8 GB file gives issue - RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range #81

Open
nitinrgoyal opened this issue Nov 10, 2021 · 2 comments
Assignees

Comments

@nitinrgoyal
Copy link

Using latest version of clamscan, I am getting the following error when I try to load a 3.8 GB file.

node-clam: Provided stream is readable.
node-clam: Attempting to establish socket/TCP connection for "scanStream"
node-clam: using local unix domain socket: /var/run/clamav/clamd.ctl
internal/buffer.js:69
throw new ERR_OUT_OF_RANGE('value', range, value);
^

RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 3875796802
at checkInt (internal/buffer.js:69:11)
at writeU_Int32BE (internal/buffer.js:799:3)
at Buffer.writeInt32BE (internal/buffer.js:887:10)
at NodeClamTransform._transform (/home/repo-l2/Documents/projects/ge-clam/node_modules/clamscan/lib/NodeClamTransform.js:44:14)
at NodeClamTransform.Transform._read (internal/streams/transform.js:205:10)
at NodeClamTransform.Transform._write (internal/streams/transform.js:193:12)
at writeOrBuffer (internal/streams/writable.js:358:12)
at NodeClamTransform.Writable.write (internal/streams/writable.js:303:10)
at Readable.ondata (internal/streams/readable.js:726:22)
at Readable.emit (events.js:375:28) {
code: 'ERR_OUT_OF_RANGE'
}

@kylefarris
Copy link
Owner

It seems like the buffer is filling up faster than it can be offloaded to the downstream target. Can you share the relevant part of your code?

@kylefarris kylefarris self-assigned this Nov 10, 2021
@project-administrator
Copy link

No, it's writeInt32BE function failing in one of these places:
https://github.com/kylefarris/clamscan/search?q=writeInt32BE

It cannot process value bigger than 4 bytes signed integer:

⋊> ~ node                                                                                        07:41:17
Welcome to Node.js v16.9.1.
Type ".help" for more information.
> const size = Buffer.alloc(4);
undefined
> size.writeInt32BE(2442710324, 0);
Uncaught:
RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 2442710324
    at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
    at new NodeError (node:internal/errors:371:5)
    at checkInt (node:internal/buffer:72:11)
    at writeU_Int32BE (node:internal/buffer:802:3)
    at Buffer.writeInt32BE (node:internal/buffer:890:10) {
  code: 'ERR_OUT_OF_RANGE'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants