Skip to content

Gzip with a large buffer source doesn't raise an error #60809

@junbao00

Description

@junbao00

Version

v24.11.1

Platform

Linux cc96c567cc46 6.12.53 #1 SMP PREEMPT_DYNAMIC Tue Oct 28 18:05:29 UTC 2025 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

import { createReadStream, createWriteStream } from 'node:fs';
import { Readable } from 'node:stream';
import { pipeline } from 'node:stream/promises';
import { createGunzip, createGzip } from 'node:zlib';
import { buffer } from 'node:stream/consumers';

const buf = Buffer.allocUnsafe(4646837723);
await pipeline(Readable.from([buf]), createGzip(), createWriteStream('test.gz', { flags: 'w' }));
const out = await buffer(createReadStream('test.gz').pipe(createGunzip()));
console.log(out.length);

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

Always

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

throw an error or output 4646837723

What do you see instead?

output 351870427

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions