Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: run test-abort-aliased-buffer-overflow #32626

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/abort/test_abort-aliased-buffer-overflow/binding.cc
Expand Up @@ -21,3 +21,5 @@ void init(v8::Local<v8::Object> exports) {
"allocateAndResizeBuffer",
AllocateAndResizeBuffer);
}

NODE_MODULE(NODE_GYP_MODULE_NAME, init)
@@ -1,7 +1,8 @@
'use strict';
const common = require('../common');
const common = require('../../common');
const assert = require('assert');
const cp = require('child_process');
const debuglog = require('util').debuglog('test');

// This test ensures that during resizing of an Aliased*Array the computation
// of the new size does not overflow.
Expand All @@ -10,19 +11,22 @@ if (process.argv[2] === 'child') {
// test
const binding = require(`./build/${common.buildType}/binding`);

const bigValue = BigInt('0xE000 0000 E000 0000');
binding.AllocateAndResizeBuffer(bigValue);
const bigValue = BigInt('0xE0000000E0000000');
binding.allocateAndResizeBuffer(bigValue);
assert.fail('this should be unreachable');
} else {
// observer
const child = cp.spawn(`${process.execPath}`, [`${__filename}`, 'child']);
let stderr = '';
let stdout = '';
child.stderr.setEncoding('utf8');
child.stdout.setEncoding('utf8');
child.stderr.on('data', (data) => stderr += data);
child.stdout.on('data', (data) => stdout += data);
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');
}
debuglog(`exit with code ${code}, signal ${signal}`);
debuglog(stdout);
debuglog(stderr);
assert.ok(common.nodeProcessAborted(code, signal));
}));
}
4 changes: 3 additions & 1 deletion test/testpy/__init__.py
Expand Up @@ -144,6 +144,8 @@ def SelectTest(name):
for f in os.listdir(os.path.join(path, subpath)):
if SelectTest(f):
result.append([subpath, f[:-3]])
elif SelectTest(subpath):
result.append([subpath[:-3]])
return result

def ListTests(self, current_path, path, arch, mode):
Expand All @@ -156,7 +158,7 @@ def ListTests(self, current_path, path, arch, mode):
SimpleTestCase(tst, file_path, arch, mode, self.context, self, self.additional_flags))
return result

class AbortTestConfiguration(SimpleTestConfiguration):
class AbortTestConfiguration(AddonTestConfiguration):
def __init__(self, context, root, section, additional=None):
super(AbortTestConfiguration, self).__init__(context, root, section,
additional)
Expand Down
1 change: 1 addition & 0 deletions tools/test.py
Expand Up @@ -1488,6 +1488,7 @@ def PrintCrashed(code):
# default JavaScript test-run, e.g., internet/ requires a network connection,
# addons/ requires compilation.
IGNORED_SUITES = [
'abort',
'addons',
'benchmark',
'doctool',
Expand Down
2 changes: 1 addition & 1 deletion vcbuild.bat
Expand Up @@ -92,7 +92,7 @@ if /i "%1"=="noetw" set noetw=1&goto arg-ok
if /i "%1"=="ltcg" set ltcg=1&goto arg-ok
if /i "%1"=="licensertf" set licensertf=1&goto arg-ok
if /i "%1"=="test" set test_args=%test_args% -J %common_test_suites%&set lint_cpp=1&set lint_js=1&set lint_md=1&goto arg-ok
if /i "%1"=="test-ci-native" set test_args=%test_args% %test_ci_args% -J -p tap --logfile test.tap %CI_NATIVE_SUITES% %CI_DOC%&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1&set cctest_args=%cctest_args% --gtest_output=xml:cctest.junit.xml&goto arg-ok
if /i "%1"=="test-ci-native" set test_args=%test_args% %test_ci_args% -J -p tap --logfile test.tap %CI_NATIVE_SUITES% %CI_DOC%&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1&set build_abort_tests=1&set cctest_args=%cctest_args% --gtest_output=xml:cctest.junit.xml&goto arg-ok
if /i "%1"=="test-ci-js" set test_args=%test_args% %test_ci_args% -J -p tap --logfile test.tap %CI_JS_SUITES%&set no_cctest=1&goto arg-ok
if /i "%1"=="build-addons" set build_addons=1&goto arg-ok
if /i "%1"=="build-js-native-api-tests" set build_js_native_api_tests=1&goto arg-ok
Expand Down