Closed
Description
- Version: v14.15.1
- Platform: Linux 5.8.0-38-generic The binary and long term compatibility with node #43~20.04.1-Ubuntu SMP Tue Jan 12 16:39:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: crypto.pseudoRandomBytes
What steps will reproduce the bug?
Setup a node instance,
» node
and run the following javascript code.
crypto.pseudoRandomBytes(2147483648)
Then a segmentation fault occurs.
How often does it reproduce? Is there a required condition?
This problem can always be triggered following the steps above.
Noticed that 2147483647
would not cause this problem. It seems to result from an integer overflow.
What is the expected behavior?
If any error occurs, an exception or other similar error-reporting stuff should be thrown. There is no reason to abort the whole node process.
What do you see instead?
» node
Welcome to Node.js v14.15.1.
Type ".help" for more information.
> crypto.pseudoRandomBytes(2147483647)
<Buffer b7 d9 2d 27 37 50 a1 4b df f3 a2 ad fa 85 16 8e e6 a2 c4 98 a3 48 9a 65 1f 3a c1 9e d8 c1 6e bb ed ef ed 85 dc ae b7 6f 5c 53 7e 09 fb a9 1d 66 7e d5 ... 2147483597 more bytes>
> crypto.pseudoRandomBytes(2147483648)
[1] 2791292 segmentation fault node