Skip to content

buffer.toString fails for buffers larger than 192MB #4266

Description

@skilledDeveloper

buffer.toString with base64 encoding fails for any buffer larger than or equal to 201326581 bytes (~192 MB).

See the following piece of code:

var buf1 = new Buffer(201326580),  //biggest buffer that works
    buf2 = new Buffer(201326581);  //~192 MB
buf1.toString('base64'); //works
buf2.toString('base64'); //fails!

For older node versions (like v0.12.2) this cause the process to crash with this error:

#
# Fatal error in d:\jenkins\workspace\nodejs-msi-julien\d8c2e2bb\deps\v8\src/handles.h, line 48
# CHECK(location_ != NULL) failed
#
Segmentation fault      

For newer versions (like v5.2.0), it gives the following error:

buffer.js:401
    throw new Error('toString failed');
    ^

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions