| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 58c7034 commit 5b5e519
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,7 @@ const { | |||
| 16 | 16 | validateObject, | |
| 17 | 17 | validateString, | |
| 18 | 18 | validateStringArray, | |
| 19 | - validateUint32, | ||
| 19 | + validateInt32, | ||
| 20 | 20 | } = require('internal/validators'); | |
| 21 | 21 | const { | |
| 22 | 22 | ERR_INVALID_ARG_TYPE, | |
@@ -46,8 +46,8 @@ function internalCompileFunction(code, params, options) { | |||
| 46 | 46 | } = options; | |
| 47 | 47 | ||
| 48 | 48 | validateString(filename, 'options.filename'); | |
| 49 | - validateUint32(columnOffset, 'options.columnOffset'); | ||
| 50 | - validateUint32(lineOffset, 'options.lineOffset'); | ||
| 49 | + validateInt32(columnOffset, 'options.columnOffset'); | ||
| 50 | + validateInt32(lineOffset, 'options.lineOffset'); | ||
| 51 | 51 | if (cachedData !== undefined) | |
| 52 | 52 | validateBuffer(cachedData, 'options.cachedData'); | |
| 53 | 53 | validateBoolean(produceCachedData, 'options.produceCachedData'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,34 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + require('../common'); | ||
| 4 | + | ||
| 5 | + const assert = require('assert'); | ||
| 6 | + const { compileFunction } = require('node:vm'); | ||
| 7 | + | ||
| 8 | + const min = -2147483648; | ||
| 9 | + const max = 2147483647; | ||
| 10 | + | ||
| 11 | + compileFunction('', [], { lineOffset: min, columnOffset: min }); | ||
| 12 | + compileFunction('', [], { lineOffset: max, columnOffset: max }); | ||
| 13 | + | ||
| 14 | + assert.throws( | ||
| 15 | + () => { | ||
| 16 | + compileFunction('', [], { lineOffset: min - 1, columnOffset: max }); | ||
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + code: 'ERR_OUT_OF_RANGE', | ||
| 20 | + name: 'RangeError', | ||
| 21 | + message: /The value of "options\.lineOffset" is out of range/, | ||
| 22 | + } | ||
| 23 | + ); | ||
| 24 | + | ||
| 25 | + assert.throws( | ||
| 26 | + () => { | ||
| 27 | + compileFunction('', [], { lineOffset: min, columnOffset: min - 1 }); | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + code: 'ERR_OUT_OF_RANGE', | ||
| 31 | + name: 'RangeError', | ||
| 32 | + message: /The value of "options\.columnOffset" is out of range/, | ||
| 33 | + } | ||
| 34 | + ); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments