mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
d54e0f8e52
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the tests conform to the standard test structure. - Rename test-regress-GH-io-1068 to test-tty-stdin-end - Rename test-regress-GH-io-1811 to test-zlib-kmaxlength-rangeerror - Rename test-regress-GH-node-9326 to test-kill-segfault-freebsd - Rename test-timers-regress-GH-9765 to test-timers-setimmediate-infinite-loop - Rename test-tls-pfx-gh-5100-regr to test-tls-pfx-authorizationerror - Rename test-tls-regr-gh-5108 to test-tls-tlswrap-segfault PR-URL: https://github.com/nodejs/node/pull/19332 Fixes: https://github.com/nodejs/node/issues/19105 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
29 lines
759 B
JavaScript
29 lines
759 B
JavaScript
'use strict';
|
|
require('../common');
|
|
|
|
// This test ensures that zlib throws a RangeError if the final buffer needs to
|
|
// be larger than kMaxLength and concatenation fails.
|
|
// https://github.com/nodejs/node/pull/1811
|
|
|
|
const assert = require('assert');
|
|
|
|
// Change kMaxLength for zlib to trigger the error without having to allocate
|
|
// large Buffers.
|
|
const buffer = require('buffer');
|
|
const oldkMaxLength = buffer.kMaxLength;
|
|
buffer.kMaxLength = 128;
|
|
const zlib = require('zlib');
|
|
buffer.kMaxLength = oldkMaxLength;
|
|
|
|
const encoded = Buffer.from('H4sIAAAAAAAAA0tMHFgAAIw2K/GAAAAA', 'base64');
|
|
|
|
// Async
|
|
zlib.gunzip(encoded, function(err) {
|
|
assert.ok(err instanceof RangeError);
|
|
});
|
|
|
|
// Sync
|
|
assert.throws(function() {
|
|
zlib.gunzipSync(encoded);
|
|
}, RangeError);
|