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

string_decoder: throw an error when writing a too long buffer #52215

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kylo5aby
Copy link
Contributor

Fixes: #52214

@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Mar 26, 2024
@mertcanaltin mertcanaltin added the string_decoder Issues and PRs related to the string_decoder subsystem. label Mar 26, 2024
@theanarkh theanarkh added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 27, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 27, 2024
@nodejs-github-bot
Copy link
Collaborator

@theanarkh
Copy link
Contributor

The test will fail on some platforms. It looks like 2**31 is too big.

13:29:07 not ok 947 pummel/test-string-decoder-large-buffer
13:29:07   ---
13:29:07   duration_ms: 231.98500
13:29:07   severity: fail
13:29:07   exitcode: 1
13:29:07   stack: |-
13:29:07     C:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-string-decoder-large-buffer.js:24
13:29:07         throw e;
13:29:07         ^
13:29:07     
13:29:07     RangeError [ERR_OUT_OF_RANGE]: The value of "size" is out of range. It must be >= 0 && <= 2147483647. Received 2147483648
13:29:07         at Function.alloc (node:buffer:389:3)
13:29:07         at Object.<anonymous> (C:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-string-decoder-large-buffer.js:18:22)
13:29:07         at Module._compile (node:internal/modules/cjs/loader:1421:14)
13:29:07         at Module._extensions..js (node:internal/modules/cjs/loader:1499:10)
13:29:07         at Module.load (node:internal/modules/cjs/loader:1232:32)
13:29:07         at Module._load (node:internal/modules/cjs/loader:1048:12)
13:29:07         at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:187:14)
13:29:07         at node:internal/main/run_main_module:28:49 {
13:29:07       code: 'ERR_OUT_OF_RANGE'
13:29:07     }
13:29:07     

@kylo5aby kylo5aby force-pushed the string_decoder branch 3 times, most recently from f691105 to dbb31b1 Compare March 27, 2024 13:39
@kylo5aby
Copy link
Contributor Author

kylo5aby commented Mar 27, 2024

The test will fail on some platforms. It looks like 2**31 is too big.

13:29:07 not ok 947 pummel/test-string-decoder-large-buffer
13:29:07   ---
13:29:07   duration_ms: 231.98500
13:29:07   severity: fail
13:29:07   exitcode: 1
13:29:07   stack: |-
13:29:07     C:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-string-decoder-large-buffer.js:24
13:29:07         throw e;
13:29:07         ^
13:29:07     
13:29:07     RangeError [ERR_OUT_OF_RANGE]: The value of "size" is out of range. It must be >= 0 && <= 2147483647. Received 2147483648
13:29:07         at Function.alloc (node:buffer:389:3)
13:29:07         at Object.<anonymous> (C:\workspace\node-test-binary-windows-js-suites\node\test\pummel\test-string-decoder-large-buffer.js:18:22)
13:29:07         at Module._compile (node:internal/modules/cjs/loader:1421:14)
13:29:07         at Module._extensions..js (node:internal/modules/cjs/loader:1499:10)
13:29:07         at Module.load (node:internal/modules/cjs/loader:1232:32)
13:29:07         at Module._load (node:internal/modules/cjs/loader:1048:12)
13:29:07         at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:187:14)
13:29:07         at node:internal/main/run_main_module:28:49 {
13:29:07       code: 'ERR_OUT_OF_RANGE'
13:29:07     }
13:29:07     

I believe it's because of the buffer with size > INT32_MAX on x32 platform which will throw range error, I have updated and skip the test file on x32 platform

@kylo5aby
Copy link
Contributor Author

@theanarkh Could you pls retrigger CI?

@theanarkh theanarkh added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 24, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 24, 2024
@nodejs-github-bot
Copy link
Collaborator

@theanarkh theanarkh added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 24, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 24, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. string_decoder Issues and PRs related to the string_decoder subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StringDecoder.write() doesn't report error when buffer length exceeds max integer value
7 participants