Skip to content

Commit

Permalink
Release 3.9.16
Browse files Browse the repository at this point in the history
  • Loading branch information
XmiliaH committed Apr 11, 2023
1 parent 115d164 commit 24c724d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v3.9.16 (2023-04-11)
--------------------
[fix] Security fix (see https://github.com/patriksimek/vm2/issues/516).

v3.9.15 (2023-04-06)
--------------------
[fix] Security fix (see https://github.com/patriksimek/vm2/issues/515).
Expand Down
14 changes: 7 additions & 7 deletions lib/transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ function transformer(args, body, isAsync, isGenerator, filename) {
__proto__: null,
pos: node.start,
order: TO_RIGHT,
code: `catch($tmpname){try{throw ${INTERNAL_STATE_NAME}.handleException($tmpname);}`
coder: () => `catch(${tmpname}){try{throw(${tmpname}=${INTERNAL_STATE_NAME}.handleException(${tmpname}));}`
});
insertions.push({
__proto__: null,
pos: node.body.end,
order: TO_LEFT,
code: `}`
coder: () => `}`
});
} else {
const name = assertType(param, 'Identifier').name;
Expand All @@ -134,7 +134,7 @@ function transformer(args, body, isAsync, isGenerator, filename) {
__proto__: null,
pos: cBody.body[0].start,
order: TO_LEFT,
code: `${name}=${INTERNAL_STATE_NAME}.handleException(${name});`
coder: () => `${name}=${INTERNAL_STATE_NAME}.handleException(${name});`
});
}
}
Expand All @@ -144,13 +144,13 @@ function transformer(args, body, isAsync, isGenerator, filename) {
__proto__: null,
pos: node.object.start,
order: TO_LEFT,
code: INTERNAL_STATE_NAME + '.wrapWith('
coder: () => INTERNAL_STATE_NAME + '.wrapWith('
});
insertions.push({
__proto__: null,
pos: node.object.end,
order: TO_RIGHT,
code: ')'
coder: () => ')'
});
} else if (nodeType === 'Identifier') {
if (node.name === INTERNAL_STATE_NAME) {
Expand All @@ -165,7 +165,7 @@ function transformer(args, body, isAsync, isGenerator, filename) {
__proto__: null,
pos: node.start,
order: TO_RIGHT,
code: INTERNAL_STATE_NAME + '.'
coder: () => INTERNAL_STATE_NAME + '.'
});
}
});
Expand All @@ -186,7 +186,7 @@ function transformer(args, body, isAsync, isGenerator, filename) {
let curr = 0;
for (let i = 0; i < insertions.length; i++) {
const change = insertions[i];
ncode += code.substring(curr, change.pos) + change.code.replace(/\$tmpname/g, tmpname);
ncode += code.substring(curr, change.pos) + change.coder();
curr = change.pos;
}
ncode += code.substring(curr);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"alcatraz",
"contextify"
],
"version": "3.9.15",
"version": "3.9.16",
"main": "index.js",
"sideEffects": false,
"repository": "github:patriksimek/vm2",
Expand Down

0 comments on commit 24c724d

Please sign in to comment.