Skip to content

Commit

Permalink
src,inspector: fix empty MaybeLocal crash
Browse files Browse the repository at this point in the history
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: #42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: #42409
Backport--PR-URL: #42967
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
RaisinTen authored and juanarbol committed May 31, 2022
1 parent 55bbdd7 commit 542744b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/pummel/test-repl-empty-maybelocal-crash.js
@@ -0,0 +1,20 @@
'use strict';
const common = require('../common');

if (process.config.variables.arm_version === '7') {
common.skip('Too slow for armv7 bots');
}

// The process should not crash when the REPL receives the string, 'ss'.
// Test for https://github.com/nodejs/node/issues/42407.

const repl = require('repl');

const r = repl.start();

r.write('var buf = Buffer.from({length:200e6},(_,i) => i%256);\n');
r.write('var ss = buf.toString("binary");\n');
r.write('ss');
r.write('.');

r.close();

0 comments on commit 542744b

Please sign in to comment.