From a56b600e93a3eae72994a059cc708572bdcaf123 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Fri, 1 May 2020 07:06:39 -0400 Subject: [PATCH] Revert "src: add aliased-buffer-overflow abort test" This reverts commit babeb58c5286c55f00e6dfc48c0b609314bcc381. PR-URL: https://github.com/nodejs/node/pull/33196 Refs: https://github.com/nodejs/node/pull/31740 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- test/abort/common.gypi | 8 ------ .../binding.cc | 23 --------------- .../binding.gyp | 9 ------ .../test-abort-aliased-buffer-overflow.js | 28 ------------------- 4 files changed, 68 deletions(-) delete mode 100644 test/abort/common.gypi delete mode 100644 test/abort/test_abort-aliased-buffer-overflow/binding.cc delete mode 100644 test/abort/test_abort-aliased-buffer-overflow/binding.gyp delete mode 100644 test/abort/test_abort-aliased-buffer-overflow/test-abort-aliased-buffer-overflow.js diff --git a/test/abort/common.gypi b/test/abort/common.gypi deleted file mode 100644 index 19396c61856af3..00000000000000 --- a/test/abort/common.gypi +++ /dev/null @@ -1,8 +0,0 @@ -{ - 'defines': [ 'V8_DEPRECATION_WARNINGS=1', 'NODE_WANT_INTERNALS=1' ], - 'conditions': [ - [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { - 'cflags': ['-Wno-cast-function-type'], - }], - ], -} diff --git a/test/abort/test_abort-aliased-buffer-overflow/binding.cc b/test/abort/test_abort-aliased-buffer-overflow/binding.cc deleted file mode 100644 index c3bf66061bf0ee..00000000000000 --- a/test/abort/test_abort-aliased-buffer-overflow/binding.cc +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -#include -#include - -void AllocateAndResizeBuffer( - const v8::FunctionCallbackInfo& args) { - v8::Isolate* isolate = args.GetIsolate(); - int64_t length = args[0].As()->Int64Value(); - - node::AliasedBigUint64Array array{isolate, 0}; - - array.reserve(length); - assert(false); - } - -void init(v8::Local exports) { - NODE_SET_METHOD(exports, - "allocateAndResizeBuffer", - AllocateAndResizeBuffer); -} diff --git a/test/abort/test_abort-aliased-buffer-overflow/binding.gyp b/test/abort/test_abort-aliased-buffer-overflow/binding.gyp deleted file mode 100644 index 55fbe7050f18e4..00000000000000 --- a/test/abort/test_abort-aliased-buffer-overflow/binding.gyp +++ /dev/null @@ -1,9 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'binding', - 'sources': [ 'binding.cc' ], - 'includes': ['../common.gypi'], - } - ] -} diff --git a/test/abort/test_abort-aliased-buffer-overflow/test-abort-aliased-buffer-overflow.js b/test/abort/test_abort-aliased-buffer-overflow/test-abort-aliased-buffer-overflow.js deleted file mode 100644 index 33cd21295848b9..00000000000000 --- a/test/abort/test_abort-aliased-buffer-overflow/test-abort-aliased-buffer-overflow.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const cp = require('child_process'); - -// This test ensures that during resizing of an Aliased*Array the computation -// of the new size does not overflow. - -if (process.argv[2] === 'child') { - // test - const binding = require(`./build/${common.buildType}/binding`); - - const bigValue = BigInt('0xE000 0000 E000 0000'); - binding.AllocateAndResizeBuffer(bigValue); - assert.fail('this should be unreachable'); -} else { - // observer - const child = cp.spawn(`${process.execPath}`, [`${__filename}`, 'child']); - child.on('exit', common.mustCall(function(code, signal) { - if (common.isWindows) { - assert.strictEqual(code, 134); - assert.strictEqual(signal, null); - } else { - assert.strictEqual(code, null); - assert.strictEqual(signal, 'SIGABRT'); - } - })); -}