Skip to content

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

Closed
@kylo5aby

Description

@kylo5aby

Version

21.6.0

Platform

Linux benchmark-S2600WFT 5.15.0-41-generic #44-Ubuntu x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

const { StringDecoder } = require('node:string_decoder');
const buf = Buffer.allocUnsafeSlow(2 ** 31);
console.log(decoder.write(buf).length); // 0

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

When executing console.log(decoder.write(buf).length);, expect throw an string longer error instead of output 0

What do you see instead?

output: 0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    string_decoderIssues and PRs related to the string_decoder subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions