mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
src: fix c++ exception on bad command line arg
Replace stoull() with strtoull(). The former throws an exception when the input is malformed, the latter doesn't. Fixes: https://github.com/nodejs/node/issues/46223 PR-URL: https://github.com/nodejs/node/pull/46290 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
940484b7aa
commit
fb7bee2b6e
2 files changed
+4
-3
No files matched your search
@@ -444,7 +444,8 @@ void OptionsParser<Options>::Parse(
|
||||
*Lookup<int64_t>(info.field, options) = std::atoll(value.c_str());
|
||||
break;
|
||||
case kUInteger:
|
||||
*Lookup<uint64_t>(info.field, options) = std::stoull(value);
|
||||
*Lookup<uint64_t>(info.field, options) =
|
||||
std::strtoull(value.c_str(), nullptr, 10);
|
||||
break;
|
||||
case kString:
|
||||
*Lookup<std::string>(info.field, options) = value;
|
||||
|
||||
@@ -58,11 +58,11 @@ const {
|
||||
}
|
||||
|
||||
// --cpu-prof-interval without --cpu-prof
|
||||
{
|
||||
for (const arg of [kCpuProfInterval, 'crashme']) {
|
||||
tmpdir.refresh();
|
||||
const output = spawnSync(process.execPath, [
|
||||
'--cpu-prof-interval',
|
||||
kCpuProfInterval,
|
||||
arg,
|
||||
fixtures.path('workload', 'fibonacci.js'),
|
||||
], {
|
||||
cwd: tmpdir.path,
|
||||
|
||||
Reference in new issue
Block a user