Node: Regression of allowed String length, `buffer.constants.MAX_STRING_LENGTH`

Created on 5 Feb 2020  路  5Comments  路  Source: nodejs/node

  • Version: Node v13.6.0
  • Platform: Windows 10 x64
  • Subsystem: N/A

Upgraded from Node v12.3.1 to v13.6.0 and there is a regression of allowed string length (which causes a RangeError: Invalid string length error during JSON.stringify(...) operation in our code) as per below output:

v12.3.1

> require('buffer').constants.MAX_STRING_LENGTH;
< 1073741799

v13.6.0

> require('buffer').constants.MAX_STRING_LENGTH;
< 268435440

On that related note is there a way to increase the limit by re-compiling with the constant updated? If so any tips would be appreciated

question

Most helpful comment

I've confirmed it's x64 version. In the mean time I posted an issue with NW.js as perhaps the culprit is their integration with node.js - https://github.com/nwjs/nw.js/issues/7356

All 5 comments

hmm... check to make sure your 13.6 is not a 32-bit build. In both 13.6 and master, MAX_STRING_LENGTH is showing 1073741799 for me here (on Windows 10 x64)

I've confirmed it's x64 version. In the mean time I posted an issue with NW.js as perhaps the culprit is their integration with node.js - https://github.com/nwjs/nw.js/issues/7356

This would most likely only happen if nw.js has pointer compression enabled (see https://github.com/nodejs/TSC/issues/790 for details on that feature), and not be directly related to Node.js.

Well looks like it's a regression in v8 fixed 3 days ago. https://github.com/v8/v8/commit/ea56bf5513d0cbd2a35a9035c5c2996272b8b728

Excellent that it was fixed.

Was this page helpful?
0 / 5 - 0 ratings